2024年1月16日 星期二

ubuntu22.04 常用指令

sudo apt-get update ##用來取得遠端更新伺服器的套件檔案清單

sudo apt-get -y dist-upgrade ##更新套件

sudo apt-get clean ##清除更新時所下載回來的更新(安裝)檔案

sudo apt-get autoremove ##自動清除更新後用不到的舊版本檔案(例如舊的核心程式)


sudo du -sh /var/cache/apt ##查看目前暫存的大小

sudo apt autoclean ##清除

## sudo apt clean ##清除整個暫存


dpkg --list 'linux-image*'* ##查看已安裝的核心

apt remove linux-image-版本號  ##刪除舊版的核心(這個操作要小心點)


journalctl --disk-usage ##檢查log大小

/etc/cron.daily/logrotate

find /var/log -type f -iname *.gz -delete

journalctl --rotate

journalctl --vacuum-time=1s ##刪除


df -Th | grep -v fs ##查看現在空間狀況

sudo nautilus ##ubuntu用root權限開啟檔案管理




沒有留言:

張貼留言