更新源 sed -ri 's/http:\/\/(cn.)?archive.ubuntu.com\/ubuntu\//https:\/\/mirrors.tuna.tsinghua.edu.cn\/ubuntu\//g' /etc/apt/sources.list apt-get update Ub ...
更新源
sed -ri 's/http:\/\/(cn.)?archive.ubuntu.com\/ubuntu\//https:\/\/mirrors.tuna.tsinghua.edu.cn\/ubuntu\//g' /etc/apt/sources.list
apt-get update
Ubuntu 修改IP
vi /etc/netplan/xx.yaml
netplan apply
Ubuntu16.04 修改IP
#刪除ip
ip addr del 192.168.0.1 dev eth0
#修改ip
vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.5.205
netmask 255.255.255.0
gateway 192.168.5.1
dns-nameservers 192.168.5.28 172.30.44.20
#修改DNS
vi /etc/resolvconf/resolv.conf.d/base
#如果本Server為DNS伺服器,可以加上這一句,如果不是,可以不加
search localdomain
nameserver 172.16.3.4
#重啟服務
/etc/init.d/networking restart
/etc/init.d/resolvconf restart
配置root密碼
sudo –i
passwd
任務的後臺執行
&
將指令丟到後臺中去執行
[ctrl]+z
將前臺任務丟到後臺中暫停
jobs
查看後臺的工作狀態
fg %jobnumber
將後臺的任務拿到前臺來處理
bg %jobnumber
將任務放到後臺中去處理
kill
殺死後臺的任務
項目壓縮包常用
#tar包解壓
tar zxvf –C 指定路徑
#軟鏈接
ln –s 原文件名 指定文件名
systemctl命令
systemctl list-units
列出當前系統服務的狀態
systemctl list-unit-files
列出服務的開機狀態
systemctl status sshd
查看指定服務的狀態
systemctl stop sshd
關閉指定服務
systemctl start sshd
開啟指定服務
systemctl restart sshd
從新啟動服務
systemctl enable sshd
設定指定服務開機開啟
systemctl disable sshd
設定指定服務開機關閉
systemctl reload sshd
使指定服務從新載入配置
systemctl list-dependencies sshd
查看指定服務的倚賴關係
systemctl mask sshd
凍結指定服務
systemctl unmask sshd
啟用服務
systemctl set-default
multi-user.target 開機不開啟圖形
systemctl set-default
graphical.target 開機啟動圖形
setterm
文本界面設定color
清理服務
systemctl stop [servicename]
systemctl disable [servicename]
rm /etc/systemd/system/[servicename]
rm /etc/systemd/system/[servicename] # and symlinks that might be related
rm /usr/lib/systemd/system/[servicename]
rm /usr/lib/systemd/system/[servicename] # and symlinks that might be related
systemctl daemon-reload
systemctl reset-failed
字元集
locale –a
查看下載的字元集