Frequently Used apt Commands


Posted on Sun, Jul 21, 2024
Tags linux, ubuntu, ops
linux, ubuntu, ops
šŸ“ This article is a translation of the original Japanese post. View original

apt: The Package Manager on Debian-based Systems

According to APT (software) - Wikipedia, apt stands for Advanced Package Tool. I often forget the commands, so I’m compiling them here as a reference.

Note that apt-get and apt-cache are commands built for specific purposes, while apt is the CLI command for using those tools interactively.

Update Package List

1sudo apt-get update

Upgrade All Packages

1# Note: this also upgrades the linux kernel version
2sudo apt upgrade

List Installed Packages

1sudo apt list --installed | less

Uninstall Unnecessary Packages and Clean Up

1sudo apt autoremove -y && sudo apt clean

Reference

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