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
sudo apt-get update
Upgrade All Packages
# Note: this also upgrades the linux kernel version
sudo apt upgrade
List Installed Packages
sudo apt list --installed | less
Uninstall Unnecessary Packages and Clean Up
sudo apt autoremove -y && sudo apt clean
Reference
apt 2.4.12
$ apt -h
Most used commands:
list - list packages based on package names
search - search in package descriptions
show - show package details
install - install packages
reinstall - reinstall packages
remove - remove packages
autoremove - Remove automatically all unused packages
update - update list of available packages
upgrade - upgrade the system by installing/upgrading packages
full-upgrade - upgrade the system by removing/installing/upgrading packages
edit-sources - edit the source information file
satisfy - satisfy dependency strings
$ apt-get -h
Most used commands:
update - Retrieve new lists of packages
upgrade - Perform an upgrade
install - Install new packages (pkg is libc6 not libc6.deb)
reinstall - Reinstall 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
satisfy - Satisfy dependency strings
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-cache -h
Most used commands:
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