APT-GET 和 APT-CACHE 包管理器的基本命令
Apt-get 是用於處理應用程式的命令列實用程式,可以被認為是使用 APT 庫的其他工具的“後端”。Apt-cache 對 APT 的包執行各種操作。本文介紹了“APT-GET 和 APT-CACHE 包管理器的基本命令”。
Apt-get
要獲取有關 apt-get 的更多選項,請使用以下命令:
$ apt-get -h
示例輸出包含以下選項:
update - Retrieve new lists of packages upgrade - Perform an upgrade install - Install new packages (pkg is libc6 not libc6.deb) remove - Remove packages purge - Remove packages and config files autoremove - Remove automatically all unused packages dist-upgrade - Distribution upgrade, see apt-get(8) dselect-upgrade - Follow dselect selections build-dep - Configure build-dependencies for source packages clean - Erase downloaded archive files autoclean - Erase old downloaded archive files check - Verify that there are no broken dependencies source - Download source archives download - Download the binary package into the current directory changelog - Download and display the changelog for the given package
安裝包
要使用 apt-get 安裝包,請使用以下命令:
$ sudo apt-get install <package name>
升級軟體包
要升級軟體包,請使用以下命令:
$ sudo apt-get upgrade
刪除未使用的包
要自動刪除所有未使用的包,請使用以下命令:
$ sudo apt-get autoremove
刪除已下載的歸檔檔案
要刪除已下載的歸檔檔案,請使用以下命令:
$ sudo apt-get clean
刪除舊的已下載歸檔檔案
要刪除舊的已下載歸檔檔案,請使用以下命令:
$ sudo apt-get autoclean
驗證損壞的依賴項
要驗證是否存在損壞的依賴項,請使用以下命令:
$ sudo apt-get check
Apt-cache
要獲取有關 apt-cache 的更多選項,請使用以下命令:
$ sudo apt-cache --help
apt-cache 的示例選項如下所示:
showsrc - Show source records search - Search the package list for a regex pattern depends - Show raw dependency information for a package rdepends - Show reverse dependency information for a package show - Show a readable record for the package pkgnames - List the names of all packages in the system policy - Show policy settings
獲取包的依賴項
要獲取包或源記錄的依賴項,請使用以下命令:
$sudo apt-cache showsrc <packegename>
正則表示式模式的包列表
要獲取正則表示式模式的包列表,請使用以下命令:
$sudo apt-cache search <packegename>
原始依賴資訊
要顯示包的原始依賴資訊,請使用以下命令:
$ apt-cache depends <packegename>
顯示反向依賴資訊
要顯示包的反向依賴資訊,請使用以下命令:
$ apt-cache rdepends <packegename>
顯示可讀記錄
要顯示包的可讀記錄,請使用以下命令:
$ apt-cache show <packegename>
顯示所有包的名稱
要顯示系統中所有包的名稱,請使用以下命令:
$ apt-cache pkgnames
在本文中,我們學習了 APT-GET 和 APT-CACHE 包管理器的基本命令。在我們的下一篇文章中,我們將介紹更多基於 Linux 的技巧和提示。敬請關注。
廣告