APT#

Advanced Package Tool(或稱 APT), 是 Debian 及其衍生版本的主要命令列套件管理器 。它提供命令列工具 ,用於搜尋、 管理及查詢套件資訊,並提供對 libapt-pkg 與 libapt-inst 函式庫所提供的所有功能低階存取,這些功能可供高階套件管理器依賴。


Introduction#


Operate#

apt 語法aptitude 語法apt-get / apt-cache 語法說明
apt updateaptitude updateapt-get update更新軟體包檔案庫元資料
apt install fooaptitude install fooapt-get install foo安裝 “foo” 軟體包的候選版本以及其依賴
apt upgradeaptitude safe-upgradeapt-get upgrade安裝已安裝的軟體包的候選版本且不移除任何其他軟體包
apt full-upgradeaptitude full-upgradeapt-get dist-upgrade安裝已安裝軟體包的候選版本,並有需要時會移除其他軟體包
apt remove fooaptitude remove fooapt-get remove foo移除 “foo” 軟體包,但保留相關組態檔案
apt autoremoveN/Aapt-get autoremove移除不再需要的自動安裝的軟體包
apt purge fooaptitude purge fooapt-get purge foo清除 “foo” 軟體包的組態檔案
apt cleanaptitude cleanapt-get clean完全清除本地倉庫的暫存安裝套件檔案
apt autocleanaptitude autocleanapt-get autoclean移除本地倉庫中過期的暫存安裝軟體包檔案
apt show fooaptitude show fooapt-cache show foo顯示 “foo” 軟體包的詳細資訊
apt search 正則表示式aptitude search regexapt-cache search regex搜尋匹配 regex 的軟體包
N/Aaptitude why regexN/A解釋匹配 regex 的軟體包必須安裝的原因
N/Aaptitude why-not regexN/A解釋匹配 regex 的軟體包不必安裝的原因
apt list –manual-installedaptitude search ‘~i!~M’apt-mark showmanual列出手動安裝的軟體包

Reference#

Official docs:

APT

Debian 軟體包管理