Ubuntu tips

1.adb devices或adb shell找不到设备

使用lsusb查看Android设备ID
gedit ~/.android/adb_usb.ini加入ID,注意设备号是16进制,要在前面加0x
adb kill-server
adb start-server

2.不支持exfat文件系统

sudo apt-get install exfat-utils

3.终端命令参数

  • -h :一般表示以易读的方式显示结果,查看容量时常用
  • -i :不区分大小写,字符串处理时可用
  • -r :对所有文件夹/文件及其子文件夹/文件操作
  • find命令的文件名字符串中”.“就是”."
  • grep命令搜索的字符串中“."代表任意一个字符。

4. cp, mv项目过多

find sourcePath/ -name “*.txt” -exec mv {} targetPath/ \;
or
find sourcePath -name “*txt”|xargs -i mv {} targetPath/

5. 热点设置

nmcli device wifi hotspot ifname wlan0 con-name net ssid my password 12345678
生成的net文件在/etc/NetworkManager/system-connections/下面,可用于修改密码等
nmcli connection up my

6.设置开机屏幕亮度

sudo gedit /etc/rc.local
在exit 0前加 echo 666 > /sys/class/backlight/intel_backlight/brightness

7.忘记开机密码

grub菜单选择高级选项,然后选择恢复模式,选择root,进入root shell,然后运行:
mount -o rw,remount /
passwd username
输入两次新密码,提示修改成功后,输入exit退出

8.notepad安装

sudo add-apt-repository ppa:notepadqq-team/notepadqq
sudo apt-get update
sudo apt-get install notepadqq

9.ssh: connect to host ×××× port 22: Connection refused

sudo apt-get install openssh-server
/etc/init.d/ssh start

10.openssh-server开机自动启动

sudo vim /etc/rc.local
在exit 0语句前加入: /etc/init.d/ssh start

11.检测网络中有哪些在线主机

sudo nmap -sP 192.168.0.*
结果格式:
Nmap scan report for 192.168.0.111
Host is up (0.00021s latency).
MAC Address: 9C:5C:8E:D4:6A:D6 (Unknown)

12.调整屏幕分辨率

sudo vim /etc/default/grub
将 #GRUB_GFXMODE=640x480 改为 GRUB_GFXMODE=目的分辨率,保存退出
sudo update-grub
sudo reboot

13.终端查看笔记本电量

cat /sys/class/power_supply/BAT0/capacity
这是14.04的方法,电池信息一般在BAT0文件夹中,可使用以下命令寻找该文件夹
sudo find / -name BAT0

14.设置在终端打开(open in terminal)

sudo apt-get install nautilus-open-terminal
sudo reboot

15.串口别名

在/etc/udev/rules.d中新建文件myusb.rules,写入

KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0777", SYMLINK+="lidar"

如果存在多个10c4:ea60设备,则执行

udevadm info --attribute-walk --path=/sys/bus/usb-serial/devices/ttyUSB0

查看设备对应的usb端口,在上述文件中写入

KERNEL=="ttyUSB*", KERNELS=="1-2.1", MODE:="0777",SYMLINK+="ultrasonic"

在USB口固定的时候,别名有效。

16.增加swap大小

sudo fallocate /var/swapfile -l 4G
sudo chmod 600 /var/swapfile
sudo mkswap /var/swapfile
sudo swapon /var/swapfile

17.E: Sub-process /usr/bin/dpkg returned an error code (1) 或 dpkg: warning: files list file for package

cd /var/lib/dpkg
sudo mv info info.bak
sudo mkdir info
sudo apt-get -f install
sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info.bak
sudo rm -rf /var/lib/dpkg/info
sudo mv /var/lib/dpkg/info.bak /var/lib/dpkg/info

18.grub rescure

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair
boot-repair

19.U盘只读

df -h 找到U盘对应的磁盘,如:/dev/sdbX 15G 7.8G 6.9G 54% /media/Hadoop/disk
sudo dosfsck -v -a /dev/sdbX 或 sudo fsck -C -a /dev/sdbX

20. 杀死所有的××进程,以netease为例

ps aux|grep netease|grep -v grep|cut -c 9-15|xargs kill -9

21. 企业微信看不了图片

sudo apt install libjpeg62:i386

22.ACPI Error:[N_SB_.PCI O, XHC_.R HUB.HS 11] Namespace lookup failure,AE_NOT_FOUND

  • 以root用户执行

journalctl -xb
找到fsck failed的盘,例如/dev/sda8
umount /dev/sda8
fsck -y /dev/sda8
reboot

23.系统设置里没有NVIDIA驱动

sudo add-apt-repository ppa:graphics-drivers/ppa && sudo apt update

24.解压中文乱码

unzip -O GBK 参考资料.zip

25.查看占用摄像头的程序

lsof|grep video0

26.git报错:server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

export GIT_SSL_NO_VERIFY=1

27.企业微信文件下载位置

Documents/WXWork/1688853753180205/Cache/File/2022-11

28.ubuntu18.04及以上安装gcc-7, g++-7

/etc/apt/sources.list中添加deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe
然后sudo apt update
sudo apt install g++-7
安装成功后注释掉添加内容,再sudo apt update
安装更低gcc版本可用添加更低版本的Ubuntu源

29.查看摄像头支持的图片格式

v4l2-ctl --info -d /dev/video0 --list-formats-ext

30. you are in emergency mode

  1. 按回车进入命令行
  2. journalctl -xb 查看日志
  3. / fsck failed 定位错误磁盘,有两处fsck failed with exit status 4Failde to start File System Check on /dev/disk/by-uuid/2ac91ca6-42fc-4bf1-94a3-7d8fe1da1eba
  4. :q 退出日志
  5. sudo umount /dev/disk/by-uuid/2ac91ca6-42fc-4bf1-94a3-7d8fe1da1eba 卸载磁盘,有可能没挂载,不影响
  6. sudo fsck -y /dev/disk/by-uuid/2ac91ca6-42fc-4bf1-94a3-7d8fe1da1eba 修复磁盘
  7. sudo reboot 重启电脑
Sure, here are some tips for installing EGSnrc on Ubuntu: 1. Update your system: Before starting the installation process, it's always a good idea to update your system. Open a terminal and run the following command: ``` sudo apt update && sudo apt upgrade -y ``` 2. Install required dependencies: EGSnrc requires some libraries and packages to be installed. Run the following command to install them: ``` sudo apt install build-essential gfortran libx11-dev libxt-dev libxpm-dev libxft-dev libxmu-dev libglu1-mesa-dev ``` 3. Download the EGSnrc distribution: Visit the EGSnrc website (https://nrc-cnrc.github.io/EGSnrc/) and download the latest distribution file (e.g., egsnrc_vn.mmm.tar.gz), where "vn" represents the version number and "mmm" represents the release number. 4. Extract the distribution: Open a terminal and navigate to the directory where you downloaded the distribution file. Use the following command to extract it: ``` tar -xvf egsnrc_vn.mmm.tar.gz ``` 5. Set up environment variables: In order to use EGSnrc, you need to set up some environment variables. Open your shell configuration file (e.g., ~/.bashrc) in a text editor and add the following lines at the end: ``` export EGS_HOME=/path/to/egsnrc export EGS_CONFIG=/path/to/egsnrc/HEN_HOUSE/specs/your_machine_name export PATH=$PATH:$EGS_HOME/bin/$my_machine ``` Replace "/path/to/egsnrc" with the actual path where you extracted the EGSnrc distribution, and "your_machine_name" with the appropriate name for your machine (e.g., linux). 6. Compile EGSnrc: Open a terminal and navigate to the EGSnrc directory. Run the following command to compile EGSnrc: ``` make ``` 7. Verify the installation: After the compilation process completes successfully, you can run some example simulations provided with EGSnrc to verify the installation. Refer to the EGSnrc documentation for instructions on running the examples. That's it! You have now successfully installed EGSnrc on Ubuntu. Remember to consult the EGSnrc documentation for further usage instructions and details.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

刀么克瑟拉莫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值