This guide explains the differences between apt and apt-get commands, so you can decide which one to use.
Historically, you’ve probably installed software on Debian based Linux Operating Systems (like Ubuntu) using the
apt-get
command. More recently you’ve probably seen the
apt
command being used in its place in various places online, but with otherwise much the same syntax. For example:
sudo apt-get install nano
has the same effect as
sudo apt install nano
which is to install the nano text editor package on your system.
So what’s the difference?
apt-get (and apt-cache)
- The original, the classic, functional
- Better for scripting
- The more rigid command that is unlikely to change in an update
- More command-line options for advanced usage
- …But you might not ever use them
apt
- The new kid, cooler, comes with extras
- Shows progress bars, prettier to look at and easier to use
- Ease-of-use features of apt-get are enabled by default rather than via options
- Also includes commands from the apt-cache command
- Under continued development, so more features may be added
*apt is the combined, most commonly used functions of apt-get and apt-cache presented for ease of use
Syntax Differences for Common Tasks
apt command | apt-get command | |
---|---|---|
apt autoremove | apt-get autoremove | Uninstall packages that are no longer required as dependencies |
apt full-upgrade | apt-get dist-upgrade | Upgrades all packages and dependencies |
apt install package | apt-get install package | Install package |
apt remove package | apt-get remove package | Remove package |
apt purge package | apt-get purge package | Remove package along with its configuration |
apt update | apt-get update | Refreshes repository list |
apt upgrade | apt-get upgrade | Upgrades all packages |
apt command | apt-cache command | |
---|---|---|
apt search package | apt-cache search package | Search for package by name |
apt show package | apt-cache show package | Show details for package |
Note that package above will be the name(s) of the package being managed
Which Should I Use?
Use whichever one you want! apt does not replace apt-get, it is just an alternative interface to the apt package system on Debian based operating systems.
For more tutorials on how to use different applications in Linux, check out our other articles!