1、系统分区

Ubuntu官网
Ubuntu Downloads
Ubuntu Past releases
Ubuntu 18.04.6
Ubuntu 20.04.5

/EFI	500M  # 系统引导(双系统请忽略)
/boot	500M
/swap	8G    8192M
/	   	50G   
/home	300G

登录局域网服务器

快捷键【ctrl+l】
smb://192.168.x.xxx 

2、删除卸载不常用的软件

2.1、设置sudo免密码

  • 打开终端,输入命令:
sudo visudo
  • 在文档最后一行添加如下内容:
xxx ALL=(ALL) NOPASSWD:ALL
保存退出即可,其中XXX为登入用户名

2.2、libreoffice

libreoffice虽然是开源的,但是Java写出来的office执行效率实在不敢恭维,装完系统后果断删掉

sudo apt-get remove libreoffice* thunderbird totem rhythmbox empathy brasero simple-scan gnome-mahjongg aisleriot gnome-mines cheese gnome-orca webbrowser-app gnome-sudoku 

这样系统就基本上干净了。

2.3、火狐firefox浏览器

  • 查看火狐浏览器相关内容
dpkg --get-selections |grep firefox
  • 卸载上述指令中的所有文件
    执行sudo apt-get remove --purge +每一个包名字
sudo apt-get remove --purge firefox*

执行结果如下,便成功卸载火狐浏览器。

3、更换清华源

清华大学开源软件镜像站

打开文件

sudo gedit /etc/apt/sources.list 
sudo vim /etc/apt/sources.list 

删除原来的文件内容,复制下面清华源18.04LTS内容到其中并保存

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

阿里源

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

中科大

deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

163源

deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
  • 20.04LTS
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

更新软件

sudo apt update
sudo apt upgrade

4、安装常用软件

vim、terminator、fast、pip、obs、typora、rar、zip、curl、kazam、nmap等。

4.1、添加软件源和秘钥

sudo add-apt-repository ppa:notepadqq-team/notepadqq 
sudo apt install notepadqq
sudo apt-add-repository ppa:apt-fast/stable
sudo apt install apt-fast
sudo add-apt-repository -y ppa:linuxuprising/shutter
sudo apt-get install -y shutter

4.2、安装

sudo apt install vim terminator net-tools nano curl kazam nmap tree gparted nbtscan meld flameshot git libfuse2 unar rar unrar p7zip* openssh-server sshguard ffmpeg v4l2loopback-dkms

启动ssh服务:

sudo service ssh start

OBS

sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt install obs-studio

4.3、pip

  • 安装
sudo apt install python-pip python3-pip
  • pip永久加速

国内的镜像源

阿里云  https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) https://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 https://pypi.mirrors.ustc.edu.cn/simple/

1)Windows

如果用的是conda,可以在conda安装路径下找到python.exe这个路径,

建立一个名为pip.ini文件,里面输入

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

2)linux

创建 ~/.pip/pip.conf配置文件,

mkdir ~/.pip && vim ~/.pip/pip.conf

内容如下:

[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn
  • 升级
python2 -m pip install --upgrade --force pip
python3 -m pip install --upgrade --force pip

更换numpy

python3 -m pip uninstall numpy
python3 -m pip install numpy==1.19.4
  • 卸载
python2 -m pip uninstall pip
python3 -m pip uninstall pip
  • github加速的方法

用记事本打开windows上的hosts文件

C:\Windows\System32\drivers\etc\hosts 

linux的hosts文件路径在:

sudo vim /etc/hosts  

在hosts文件末尾添加两行

151.101.72.249  http://global-ssl.fastly.Net
192.30.253.112  http://github.com
151.101.228.133 raw.github.com
199.232.28.133  raw.githubusercontent.com
185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com

登录ipaddressDns查询输入查询对应的ip

github.global.ssl.fastly.net
github.com

修改host文件中的ip地址;重启电脑,让hosts文件生效;你会发现git clone的速度快很多。

4.4、OpenCV

安装

sudo apt-get install libopencv* 
python2 -m pip install --upgrade --force numpy protobuf
python3 -m pip install --upgrade --force numpy protobuf
python2 -m pip install opencv-python==3.4.6.27 opencv-contrib-python==3.4.6.27
python3 -m pip install opencv-python==3.4.6.27 opencv-contrib-python==3.4.6.27

版本升级

python2 -m pip install --upgrade --force protobuf
python3 -m pip install --upgrade --force protobuf

卸载

sudo apt-get --purge remove libopencv*
python2 -m pip uninstall opencv-python opencv-contrib-python numpy protobuf
python3 -m pip uninstall opencv-python opencv-contrib-python numpy protobuf

版本查看

python2
import cv2 as cv
cv.__version__
python3
import cv2 as cv
cv.__version__

4.5、typora

typora

# or run:
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE
wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add -
# add Typora's repository
sudo add-apt-repository 'deb https://typora.io/linux ./'
sudo apt-get update
# install typora
sudo apt-get install typora

Arch

sudo pacman -S typora

Other

download tar package

wget https://typora.io/linux/Typora-linux-x64.tar.gz
tar -zxvf Typora-linux-x64.tar.gz
cd Typora-linux-x64 && ln -s ./Typora /usr/local/bin/Typora

界面缩放

ctrl + shift + = 放大
ctrl + shift + - 缩小

启用Latex

ctrl + , (ctrl+逗号) 进入设置界面。
Preferences -> Markdown -> 勾选inline Math

在这里插入图片描述

typora导出pdf, html, word(.docx);配置pandoc

sudo apt-get install pandoc

4.6、notepad++

卸载notepad++:

sudo apt-get remove notepadqq
sudo add-apt-repository --remove ppa:notepadqq-team/notepadqq

如下载是遇到一直在waiting for headers然后失败,执行下面命令,重新安装。

sudo rm -rf /var/cache/apt/archives/partial

snap安装notepadqq

snap install --classic notepadqq

4.7、查看网段内IP

方法一:

nmap -sP 192.168.0.0-255    #从192.168.1.0到192.168.1.255所有IP

方法二:

nbtscan 192.168.2.1-254  #查找出所有能ping通的IP并带其mac地址,本地的arp也有记录

方法三:

Python代码

for ((i=0; i<=254; i++)); do ping –q –n –c 10 –W 1 –I 0.01 –w 192.168.1.$i; done   #通过ping来实现

4.8、比对工具

  • bcompare

bcompare官网

wget https://www.scootersoftware.com/bcompare-4.4.4.27058_amd64.deb
sudo apt update
sudo apt install ./bcompare-4.4.4.27058_amd64.deb
  • meld
sudo apt install meld

5、安装Chrome

5.1、下载谷歌浏览器

使用wget下载最新的Google Chrome .deb软件包:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

5.2、安装Google Chrome

sudo apt install ./google-chrome-stable_current_amd64.deb

至此,您已经在Ubuntu系统上安装了Chrome。

ubuntu每次打开chrome需要输入密码 的解决

sudo rm ~/.local/share/keyrings/Default_keyring.keyring
sudo rm ~/.local/share/keyrings/login.keyring
  • 然后重启电脑,打开 chrome,则出现下面的提示对话框,提示输入新的密码环密码。
  • 不用输入,直接点击 Continue,然后则弹出下面的对话框,警告设置了一个空白密码,存储的密码不能被安全地封装等。
  • 直接点击 Continue 即可。 最后重启电脑,测试打开谷歌浏览器,不再提示输入密码环。

6、安装搜狗输入法

6.1、安装Fcitx框架

sudo apt install fcitx-bin fcitx-table

6.2、下载安装

DingTalk客户端
DingTalk
ToDesk
WPS
VNC
XMind
飞书
百度网盘
搜狗输入法
Open3DApp
TeamViewer
balenaEtcher
Visual Studio Code
vmware虚拟机下载
[Shotwell、VLC]

vmware安装

sudo ./VMware-Workstation-Full-16.2.3-19376536.x86_64.bundle

vmware卸载

sudo vmware-installer -u vmware-workstation

然后进入相应的下载目录,进行安装(安装过程中如果有错,运行sudo apt --fix-broken install,删除安装,重新开始)

sudo dpkg -i sogou的文件名.deb  

如果遇到 dpkg: error processing package sogoupinyin (–install): dependency problems - leaving unconfigured
出现安装错误使用检查修复依赖:

sudo apt-get install -f

中间有提示,输入 Y Do you want to continue? [Y/n] Y
执行完成即可!

只能输入英文,无法输入中文解决方法

sudo apt-get install libqt5qml5 libqt5quick5 libqt5quickwidgets5 qml-module-qtquick2 libgsettings-qt1

6.3、配置

  • 进行相关设置

settings–>Region&language–>Manage Installed Languages
在这里插入图片描述

在这里插入图片描述
更改输入框架为fcitx,然后点击上面的Apply System-Wide应用到全局。然后重启系统,再继续下面的配置

在这里插入图片描述

6.4、卸载

  • 卸载ibus、顶部面板任务栏上的键盘指示(根据个人需要)
sudo apt-get --purge remove ibus indicator-keyboard
  • 卸载搜狗输入法
sudo apt-get --purge remove sogoupinyin

6.5、wps字体缺失

创建目录:

sudo mkdir /usr/share/fonts/wps-office

将下载的字体复制到创建的目录:

sudo cp -r wps_symbol_fonts.zip /usr/share/fonts/wps-office

切换到/usr/share/fonts/wps-office目录解压字体包:

cd /usr/share/fonts/wps-office
sudo unzip wps_symbol_fonts.zip

解压后删除字体包:

sudo rm -r wps_symbol_fonts.zip

再次打开就不会提示缺失字体包了!

  • 解决字体问题

字体包链接: https://pan.baidu.com/s/1i5dzB9r 密码: pwe1

sudo unzip wps_symbol_fonts.zip -d /usr/share/fonts/wps-office

在解压过程中会提醒要不要替换mtextra.ttf,选择 n 不替换;
解压完成后再次打开WPS就不会再报以上错误了。

7、安装jupyter lab

7.1、安装

  • 添加依赖
sudo apt install nodejs libssl1.0-dev nodejs-dev node-gyp npm
  • 安装jupyter/jupyterlab
python2 -m pip install jupyter jupyterlab
python3 -m pip install jupyter jupyterlab
sudo jupyter labextension install @jupyter-widgets/jupyterlab-manager @jupyterlab/statusbar

#安装jupyter notebook的代码提示功能
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user --skip-running-check
#启动jupyter notebook
jupyter notebook
#点开 Nbextensions 的选项,并勾选 Hinterland
  • 生成相应配置文件
jupyter lab --generate-config
jupyter notebook --generate-config
  • 设置密码
    (这里会设置两次,第二次为确认输入的密码)
jupyter notebook password

7.2、修改配置文件

首先输入ipython生成秘钥

ipython
from notebook.auth import passwd
passwd()

打开配置文件

sudo gedit ~/.jupyter/jupyter_lab_config.py
sudo gedit ~/.jupyter/jupyter_notebook_config.py

找到下面的三句语句,修改成相应的变化

#c.NotebookApp.ip = 'localhost'
#c.NotebookApp.open_browser = True
#c.NotebookApp.port = 8888
#c.NotebookApp.notebook_dir = ‘’

修改为

# 允许远程访问
c.NotebookApp.allow_remote_access = True  #82行
c.NotebookApp.ip='0.0.0.0'   #210行

c.NotebookApp.open_browser = False    #283行
c.NotebookApp.password = u'sha1:e5583b3a5137:a347823ea602f8c7aa5a7fd552be95cc009d5926'    #292行
c.NotebookApp.port =8888      #303行
c.NotebookApp.browser = u'/opt/google/chrome/google-chrome'

7.3、开启服务

jupyter lab --port 8080 --ip=0.0.0.0

7.4、问题收集

  • Failed building wheel for cffi,lxml,crypt
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
  • 无法初始化nvrm通道
Error: Can’t initialize nvrm channel
nvdc: open: Operation not permitted
nvdc: failed to open ‘/dev/tegra_dc_ctrl’.

解决

chromium-browser --no-sandbox 或者 chromium-browser --disable-gpu
再启动
jupyter lab 

7.5、安装最新版node和npm

方式一:

升级npm为最新版本

sudo npm install npm@latest -g

安装用于安装nodejs的模块n

sudo npm install -g n

通过n模块安装指定的nodejs

sudo n latest stable lts

查看版本

sudo node -v
sudo npm -v

方式二:

更换淘宝的镜像,这个是必须的,用过的node的人都知道。

sudo npm config set registry [https://registry.npm.taobao.org](https://registry.npm.taobao.org/)

安装更新版本的工具N

sudo npm install n -g

更新新node版本

sudo n stable

Ubuntu 卸载 Node.Js

sudo apt-get remove nodejs

8、安装系统监视器

8.1、安装indicator-sysmonitor

sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor  
sudo apt-get update 
sudo apt-get install indicator-sysmonitor  

终端执行,开启indicator-sysmonitor,然后Ctrl+C就可以实现后台运行indicator-sysmonitor!

indicator-sysmonitor &

开机自启动设置
在这里插入图片描述

自定义显示(按照下面的Sensors 进行编写显示)
在这里插入图片描述

8.2、安装Conky

安装conky和sensors

sudo apt install conky lm-sensors

复制文件

sudo cp /etc/conky/conky.conf ~/.conkyrc

开机自启

sudo vim  ~/.config/autostart/conky.desktop

[Desktop Entry]
Type=Application
Name=conky server
Exec=conky &
NoDisplay=true

设置配置文件

sudo vim ~/.conkyrc

配置文件内容

conky.config = {
    own_window_argb_visual = true,
    own_window_argb_value = 0,
    own_window_transparent = true,
    own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
    alignment = 'top_right', 
    background = true,
    border_width = 1,
    cpu_avg_samples = 2,
    default_color = 'lightgrey',
    default_outline_color = 'white',
    default_shade_color = 'white',
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    extra_newline = false,
    font = 'DejaVu Sans Mono:size=12',
    gap_x = 10,
    gap_y = 60,
    minimum_height = 260,
    minimum_width = 5,
    maximum_width = 400,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_ncurses = false,
    out_to_stderr = false,
    out_to_x = true,
    own_window = true,
    own_window_class = 'Conky',
    own_window_type = 'desktop',
    show_graph_range = false,
    show_graph_scale = false,
    stippled_borders = 0,
    update_interval = 3.0,
    uppercase = false,
    use_spacer = 'none',
    use_xft = true
}
conky.text = [[
    ${color grey}${font StyleBats:size=16}S${font OpenLogos:size=10}  System$stippled_hr
    ${color yellow}User:${alignr}${exec whoami}
    Kernel: ${alignr}$kernel
    Battery:${alignr}${battery_percent BAT1}% 
    Temp: ${alignr}${acpitemp} °C

    ${color grey}${font PizzaDude Bullets:size=16}T${font :size=10}   Date&Time $stippled_hr
    ${color green}${font :size=11} ${time %Y/%m/%e  %H:%M:%S}${alignr}   Week:${time %w}
    ${color grey}Uptime:${color #A080F0}     $uptime

    ${color grey} ${font StyleBats:size=16}V${font OpenLogos:size=10}   CPU&MEM $stippled_hr
    ${color green}${font OpenLogos:size=10} CPU@${freq}MHz: ${cpu cpu1}%${alignr}${cpubar cpu1 8,60}
    ${color green} CPU@${freq}MHz: ${cpu cpu2}%${alignr}${cpubar cpu2 8,60}

    ${color grey}${font StyleBats:size=16}T${font OpenLogos:size=10}  Thread$stippled_hr
    ${color grey}Name                     PID            CPU%          ${alignr}MEM%
    ${color #FF8C00} ${top name 1}      ${top pid 1}     ${top cpu 1} ${alignr}${top mem 1}
    ${color #FFA54F} ${top name 2}      ${top pid 2}     ${top cpu 2} ${alignr}${top mem 2}
    ${color #FFD700} ${top name 3}      ${top pid 3}     ${top cpu 3} ${alignr}${top mem 3}
    ${color #FFEC8B} ${top name 4}      ${top pid 4}     ${top cpu 4} ${alignr}${top mem 4}

    ${color grey}${font StyleBats:size=16}E${font :size=10}   MEMORY $stippled_hr
    ${color #F05020}RAM : $mem/$memmax - $memperc% ${membar 6}
    ${color green}Swap : $swap/$swapmax  ${swapbar 6}
    /:  ${fs_used /}/${fs_size /}         ${fs_bar 6 /}
    /boot: ${fs_used /boot}/${fs_size /boot}   ${fs_bar 6 /boot}
    /home: ${fs_used /home}/${fs_size /home}   ${fs_bar 6 /home}

    ${color grey} ${font PizzaDude Bullets:size=16}@${font OpenLogos:size=10}   NETWORK $stippled_hr
    ${color green}wired IP: ${addr enp2s0} Up: ${upspeedf enp2s0} KB/s Down: ${downspeedf enp2s0} KB/s
    ${color green}wlan  IP: ${addr wlp4s0} Up: ${upspeedf wlp4s0} KB/s Down: ${downspeedf wlp4s0} KB/s

    ${color grey}${font StyleBats:size=16}C ${font :size=10} CPU Temp:$stippled_hr${font OpenLogos:size=10}$color
    ${color blue}${exec sensors | grep 'Core 0'}
    ${color blue}${exec sensors | grep 'Core 1'}
    ${color blue}${exec sensors | grep 'Core 2'}
    ${color blue}${exec sensors | grep 'Core 3'}
]]

上面的conky.text中的电池名称通过以下命令查看修改

upower -i `upower -e | grep 'BAT'`

wlan名称通过以下命令查看修改

ip addr

开启conky

conky &

关闭conky

kill `pidof conky` 

运行 conky 桌面图标不显示

own_window_type 这个选项 改成override 或者 normal 试试。

9、常见问题处理

9.1、解决双系统时间不一致

在Linux下打开终端,输入命令:

timedatectl set-local-rtc 1

然后进行验证(非必要)再输入

timedatectl

在这里插入图片描述

9.2、system program problem detected

如何解决Ubuntu下的的“system program problem detected”

  • 删除crash文件
sudo rm /var/crash/*   
  • 关闭pop up功能
sudo gedit /etc/default/apport 
sudo vim /etc/default/apport 

将其中的enable=1改为enable=0即可

9.3、.bashrc输出IP地址

打开.bashrc文件

sudo vim ~/.bashrc

最下面添加

alias python=python3
ip=$(ip addr show eth0 | grep -o 'inet [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' | grep -o [0-9].*)
if [ -z $ip ]; then
  ip=$(ip addr show wlan0 | grep -o 'inet [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' | grep -o [0-9].*)
fi
if [ -z $ip ]; then
  ip=$(ip addr show lo | grep -o 'inet [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' | grep -o [0-9].*)
fi
export ROS_IP=$ip
export ROS_MASTER_URI=http://$ROS_IP:11311
echo "-- https://ghproxy.com/ -- unzip -O GBK --"
echo -e "MY_IP: \033[32m$ROS_IP\033[0m"
echo -e "ROS: \033[32m${ROS_DISTRO}\033[0m ROS_MASTER_URI: "
echo -e "\033[32m$ROS_MASTER_URI\033[0m"
echo "----- http://fls.jetbrains-agent.com -----"

9.4、乱码问题

9.4.1、vim乱码

修改.vimrc文件

sudo gedit .vimrc
sudo vim .vimrc

添加下面一行代码

set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
9.4.2、gedit乱码
gsettings set org.gnome.gedit.preferences.encodings candidate-encodings "['GB18030', 'UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']"

参考:https://www.linuxidc.com/Linux/2012-07/65713.htm

9.4.3、zip解压乱码

修改环境变量

sudo vim /etc/environment

最下面添加

UNZIP="-O CP936"
ZIPINFO="-O CP936"

命令lsar查看压缩文件内文件名

lsar 智能.zip

命令unar解压

unar 智能.zip

命令unzip解压

unzip -O CP936 xxx.zip (用GBK, GB18030也可以)
9.4.4、将中文系统改为英文
sudo vim /etc/default/locale

修改

# 修改前
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"
# 修改后
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"
9.4.5、系统中文乱码

首先,安装中文支持包language-pack-zh-hans:

sudo apt-get install language-pack-zh-hans

然后,修改

sudo gedit /etc/environment

在末尾追加

LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"

再修改

sudo gedit /var/lib/locales/supported.d/local

在末尾追加

en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_CN.GBK GBK
zh_CN GB2312

最后,执行命令:

sudo locale-gen

9.5、删除多余的内核

  • 查看使用的内核
uname -a
  • 查看当前系统中所有内核
dpkg --get-selections |grep linux
  • 删除
sudo apt-get --purge remove 
  • 更新grup移除失效的启动项(根据情况选择grub/grub2)
sudo update-grub
sudo update-grub2

9.6、错误 apt:

Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)

  • 找到并且杀掉所有的apt-get 和apt进程
ps -A | grep apt

找出所有的 apt 以及 apt-get 进程

sudo kill -9 进程ID
  • 删除锁定文件
sudo rm -r /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock

10、常用命令

10.1、python安装命令

python setup.py build
python setup.py install

10.2、查看相机设备命令

v4l2-ctl --list-formats-ext

10.3、镜像烧录和压缩命令

10.3.1、dd命令

查看磁盘号

sudo fdisk -u –l
sudo parted -l

备份

sudo dd if=/home/my/ubuntu-20.04.2-arm64.iso of=/dev/sdb 
sudo dd if=/home/my/pi.img of=/dev/sdb 
sudo dd if=/dev/sdb | gzip>/home/my/pi.img.gz

烧录

sudo gzip -dc /home/my/pi.img.gz|sudo dd of=/dev/sdb
sudo xz -cd /home/my/pi.img.xz|sudo dd of=/dev/sdb

查看进度

sudo pkill -USR1 -n -x dd
sudo pkill -USR1 -n -x xz
10.3.2、镜像压缩

参考链接:
PiShrink:制作更小的树莓派镜像文件

PiShrink github

sudo ./pishrink.sh -s aa.img pi.img

pishrink.sh脚本文件

  • window系统中格式化TF卡
a) 在cmd界面中输入[diskpart]命令
b) 在dispart工具窗口中输入查看磁盘命令: list disk
c) 选择内存卡所在的磁盘(29GB),输入指令:select disk 2
d) 输入清除命令:clean
f) 使用SD卡格式化工具再次进行格式化操作
10.3.3、stm32flash
sudo apt install stm32flash
sudo stm32flash -w AkermanRobot.hex -p /dev/ttyUSB0 -b 460800
sudo stm32flash -w AkermanRobot.hex -v -g 0 /dev/ttyUSB0 -b 460800

10.4、ubuntu版本查看

  • lsb_release -a
显示如下
Distributor ID: Ubuntu            //类别是ubuntu
Description:  Ubuntu 16.04.3 LTS  //16年3月发布的稳定版本,LTS是Long Term Support:长时间支持版本,支持周期长达三至五年
Release:    16.04                 //发行日期或者是发行版本号
Codename:   xenial                //ubuntu的代号名称
  • uname -a
显示linux的内核版本和系统是多少位的:X86_64代表系统是64位的。
  • cat /proc/version
显示如下
Linux version 4.10.0-28-generic (buildd@lgw01-12)    linux内核版本号
gcc version 5.4.0                                    gcc编译器版本号
Ubuntu 5.4.0-6ubuntu1                                Ubuntu版本号

10.5、卸载桌面命令

sudo apt-get --purge remove xfce4*
sudo apt-get --purge remove xubuntu*
sudo apt-get clean
sudo apt-get autoremove
Logo

更多推荐