Package manager used by Debian-based Linux distributions. Front-end for dpkg - easy dependency resolution and least amount of operations taken.
❕ In scripts, apt-get
should be used, as apt is intended to be
used interactively (it does not have stable interface).
Documentation: apt documentation on Ubuntu's manual pages
Standard operations:
Description | Command | Notes |
---|---|---|
Show help | apt |
|
Checking for new updates | sudo apt update |
|
Installing updates | sudo apt upgrade |
Disregard suggestion to use with auto-confirm switch -y as it's dangerous (it's best practice to review proposed changes). Capable of restarting interrupted upgrade process (issued by executing again). |
Automatic cleanup | sudo apt autoremove |
Most distributions clean unused packages automatically. Useful when there's no disk space left on root partition. |
Searching for package | sudo apt search KEYWORD |
|
Installing new package | sudo apt install PACKAGE_NAME |
|
Removing package | sudo apt remove PACKAGE_NAME |
❗ This will break system if removal of core package will get forced. |
Removing package (and its configuration) | sudo apt purge PACKAGE_NAME |
❗ This will break system if purge of core package will get forced and make recovery harder. |
Lists installed packages | apt list --installed |
|
Lists upgradable packages | apt list --upgradable |
|
Full upgrade | sudo apt full-upgrade |
❗ Unsafe - unlike apt upgrade it'll remove packages as needed. |
Dist upgrade | sudo apt dist-upgrade |
❗ Unsafe - unlike apt upgrade it'll remove/change packages as needed to upgrade to next release (potentially to non-LTS release). |
Last update: 2024-05-20