sudo apt-get update 更新源 sudo apt-get install package 安裝包 sudo apt-get remove package 刪除包 sudo apt-cache search package 搜索軟件包 sudo apt-cache show package 獲取包的相關信息,如說明、大小、版本等 sudo apt-get install package --reinstall 重新安裝包 sudo apt-get -f install 修復安裝 sudo apt-get remove package --purge 刪除包,包括配置文件等 sudo apt-get build-dep package 安裝相關的編譯環境 sudo apt-get upgrade 更新已安裝的包 sudo apt-get dist-upgrade 升級系統 sudo apt-cache depends package 了解使用該包依賴那些包 sudo apt-cache rdepends package 查看該包被哪些包依賴 sudo apt-get source package 下載該包的源代碼 sudo apt-get clean && sudo apt-get autoclean 清理無用的包 sudo apt-get check 檢查是否有損壞的依賴
修改鏡像
選擇合適的鏡像源。
推薦:https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
Ubuntu 的軟件源配置文件是 /etc/apt/sources.list
。將系統自帶的該文件做個備份,將該文件替換為下面內容,即可使用 TUNA 的軟件源鏡像。
# 默認注釋了源碼鏡像以提高 apt update 速度,如有需要可自行取消注釋 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse # deb-src 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-src 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-src 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-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse # 預發布軟件源,不建議啟用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse