APT#
Advanced Package Tool(或稱 APT), 是 Debian 及其衍生版本的主要命令列套件管理器 。它提供命令列工具 ,用於搜尋、 管理及查詢套件資訊,並提供對 libapt-pkg 與 libapt-inst 函式庫所提供的所有功能低階存取,這些功能可供高階套件管理器依賴。
Introduction#
Operate#
| apt 語法 | aptitude 語法 | apt-get / apt-cache 語法 | 說明 |
|---|---|---|---|
| apt update | aptitude update | apt-get update | 更新軟體包檔案庫元資料 |
| apt install foo | aptitude install foo | apt-get install foo | 安裝 “foo” 軟體包的候選版本以及其依賴 |
| apt upgrade | aptitude safe-upgrade | apt-get upgrade | 安裝已安裝的軟體包的候選版本且不移除任何其他軟體包 |
| apt full-upgrade | aptitude full-upgrade | apt-get dist-upgrade | 安裝已安裝軟體包的候選版本,並有需要時會移除其他軟體包 |
| apt remove foo | aptitude remove foo | apt-get remove foo | 移除 “foo” 軟體包,但保留相關組態檔案 |
| apt autoremove | N/A | apt-get autoremove | 移除不再需要的自動安裝的軟體包 |
| apt purge foo | aptitude purge foo | apt-get purge foo | 清除 “foo” 軟體包的組態檔案 |
| apt clean | aptitude clean | apt-get clean | 完全清除本地倉庫的暫存安裝套件檔案 |
| apt autoclean | aptitude autoclean | apt-get autoclean | 移除本地倉庫中過期的暫存安裝軟體包檔案 |
| apt show foo | aptitude show foo | apt-cache show foo | 顯示 “foo” 軟體包的詳細資訊 |
| apt search 正則表示式 | aptitude search regex | apt-cache search regex | 搜尋匹配 regex 的軟體包 |
| N/A | aptitude why regex | N/A | 解釋匹配 regex 的軟體包必須安裝的原因 |
| N/A | aptitude why-not regex | N/A | 解釋匹配 regex 的軟體包不必安裝的原因 |
| apt list –manual-installed | aptitude search ‘~i!~M’ | apt-mark showmanual | 列出手動安裝的軟體包 |
Reference#
Official docs: