よく使う apt コマンド


Posted on 2024年 7月 21日 (日)
Tags linux, ubuntu, ops
linux, ubuntu, ops

Debian 系でインストールされているパッケージマネージャー apt

APT \(software\) - Wikipedia によると、Advanced Package Tool の略称である apt について、よくコマンドを忘れるので備忘録としてまとめる。

ちなみに、apt-get, apt-cache コマンドは特定の用途にあわせて作られているコマンドで、apt はそれらのツールをインタラクティブに使う CLI コマンドとなっているようだ。

パッケージリストのアップデート

1sudo apt-get update

全パッケージのアップデート

1# linux kernel バージョンなどもアップデートされるので注意
2sudo apt upgrade

インストールしたパッケージのリスト

1sudo apt list --installed | less

不要なパッケージのアンインストールとクリーン

1sudo apt autoremove -y && sudo apt clean

参考

apt 2.4.12

 1$ apt -h
 2
 3Most used commands:
 4  list - list packages based on package names
 5  search - search in package descriptions
 6  show - show package details
 7  install - install packages
 8  reinstall - reinstall packages
 9  remove - remove packages
10  autoremove - Remove automatically all unused packages
11  update - update list of available packages
12  upgrade - upgrade the system by installing/upgrading packages
13  full-upgrade - upgrade the system by removing/installing/upgrading packages
14  edit-sources - edit the source information file
15  satisfy - satisfy dependency strings
16
17$ apt-get -h
18
19Most used commands:
20  update - Retrieve new lists of packages
21  upgrade - Perform an upgrade
22  install - Install new packages (pkg is libc6 not libc6.deb)
23  reinstall - Reinstall packages (pkg is libc6 not libc6.deb)
24  remove - Remove packages
25  purge - Remove packages and config files
26  autoremove - Remove automatically all unused packages
27  dist-upgrade - Distribution upgrade, see apt-get(8)
28  dselect-upgrade - Follow dselect selections
29  build-dep - Configure build-dependencies for source packages
30  satisfy - Satisfy dependency strings
31  clean - Erase downloaded archive files
32  autoclean - Erase old downloaded archive files
33  check - Verify that there are no broken dependencies
34  source - Download source archives
35  download - Download the binary package into the current directory
36  changelog - Download and display the changelog for the given package
37
38$ apt-cache -h
39
40Most used commands:
41  showsrc - Show source records
42  search - Search the package list for a regex pattern
43  depends - Show raw dependency information for a package
44  rdepends - Show reverse dependency information for a package
45  show - Show a readable record for the package
46  pkgnames - List the names of all packages in the system
47  policy - Show policy settings

Share


See also