查看ubuntu版本
lsb_release -a
cat /etc/os-release
安装ifconfig命令
apt-get install net-tools
安装ping命令
apt-get install iputils-ping
安装ip命令
apt-get install iproute2
一、卸载不必要的软件
卸载LibreOffice
sudo apt-get remove libreoffice-common
卸载Amazon的链接
apt-get purge unity-webapps-common
卸载一些预装软件
apt-get purge thunderbird totem rhythmbox empathy brasero simple-scan gnome-mahjongg aisleriot gnome-mines cheese transmission-common gnome-orca webbrowser-app gnome-sudoku landscape-client-ui-install
apt-get purge onboard deja-dup
删除Amazon广告图标
sudo rm -f /usr/share/applications/com.canonical.launcher.amazon.desktop
sudo rm -f /usr/share/applications/ubuntu-amazon-default.desktop
其他软件
sudo apt-get -y purge thunderbird* #邮件
sudo apt-get -y purge firefox #火狐浏览器
sudo apt-get -y purge deja-dup #备份
sudo apt-get -y purge simple-scan #扫描
sudo apt-get -y purge hplip* #打印
sudo apt-get -y purge printer-driver* #打印驱动
sudo apt-get -y purge rhythmbox* #音乐播放
sudo apt-get -y purge gedit* #文本编辑
sudo apt-get -y purge libreoffice* #办公套件
sudo apt-get -y purge gnome-orca #屏幕阅读
sudo apt-get -y purge onboard #屏幕键盘
sudo apt-get -y purge mahjongg #对对碰
sudo apt-get -y purge aisleriot #纸牌王
sudo apt-get -y purge gnome-sudoku #数独
sudo apt-get -y purge gnomine #扫雷
sudo apt-get -y purge wodim #命令刻碟
导航栏放在底部
gsettings set com.canonical.Unity.Launcher launcher-position Bottom
二、切换SHELL
1、查看当前发行版可以使用的shell
root@Ubuntu:~# cat /etc/shells
# /etc/shells: valid login shells /bin/sh /bin/bash /usr/bin/bash /bin/rbash /usr/bin/rbash /bin/dash /usr/bin/dash
2、查看当前使用的shell,最常用的查看shell的命令,但不能实时反映当前shell
root@Ubuntu:~# echo $SHELL
3、环境变量中shell的匹配查找
root@Ubuntu:~# env | grep SHELL
SHELL=/bin/bash
4、切换dash为bash
sudo dpkg-reconfigure dash
三、ubuntu 保存防火墙命令,iptables方式:
1、iptables 配置好策略
2、iptables-save > /etc/network/iptables.up.rules ,配置的策略保存到文件
3、iptables-apply,然后按 y 或者 iptables-restore < /etc/network/iptables.up.rules
四、更换apt源
编辑/etc/apt/sources.list文件, 在文件最前面添加以下条目(操作前请做好相应备份),保存退出后使用sudo apt-get update && sudo apt-get upgrade更新源 清华源 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-backports main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-security main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-security main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-proposed main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-proposed main restricted universe multiverse 阿里源 deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse 中科大源 deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse 网易163源 deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
五、ubuntu20.04设置开机自启动命令
1、创建rc.local文件并添加可执行权限chmod 755 /etc/rc.local
root@Ubuntu20:~# nano /etc/rc.local
#!/bin/bash echo "hello world" >/var/log/hello.log
2、编辑rc-local.service文件,在文件底部添加
root@Ubuntu20:~# nano /lib/systemd/system/rc-local.service
[Install] WantedBy=muti-user.target Alias=rc-local.service
3、最后把rc-local.service添加到开机启动
systemctl enable rc-local.service #添加到开机启动
systemctl disable rc-local.service #关闭开机启动
六、Ubuntu修改dns地址
修改/etc/systemd/resolved.conf文件,添加dns,然后退出保存。
root@Ubuntu:~# nano /etc/systemd/resolved.conf
[Resolve] DNS=114.114.114.114 8.8.8.8 #FallbackDNS= #Domains= #LLMNR=no #MulticastDNS=no #DNSSEC=no #DNSOverTLS=no #Cache=no-negative #DNSStubListener=yes #ReadEtcHosts=yes
root@Ubuntu:~# mv /etc/resolv.conf /etc/resolv.conf.bak
root@Ubuntu:~# ln -s /run/systemd/resolve/resolv.conf /etc/
root@Ubuntu:~# systemctl restart systemd-resolved.service #重启服务
root@Ubuntu:~# systemctl enable systemd-resolved.service #加入到开机启动
root@Ubuntu:~# systemd-resolve --status #查看dns地址是否修改成功
链接:
https://launchpad.net/ubuntu/+cdmirrors #ubuntu各版本下载
http://cdimage.debian.org/cdimage/archive/ #debian各版本下载
https://www.einval.com/~steve/software/jigdo/download/ #jigdo工具下载
https://www.cnblogs.com/itwangqiang/p/14302252.html #修改ubuntu网卡名为eth
https://www.cnblogs.com/liuyakai/p/14715891.html #Ubuntu修改时区和设置24小时时间格式,或使用tzselect命令修改时区