Apt is the newest alternative to Apt-Get and comes with a variety of improvements. As such, it is the suggested default for Ubuntu and other distributions. Here are some of the equivalent commands for Apt and Apt-Get.
APT Commands | APT-GET Commands | Description |
apt update | apt-get update | Update source lists and package cache |
apt -y COMMAND | apt-get -y –force-yes COMMAND | Force yes |
sudo DEBIAN_FRONTEND=noninteractive apt-get -y COMMAND | Force yes and without user interaction | |
apt upgrade | apt-get upgrade | Upgrade packages |
apt full-upgrade | apt-get dist-upgrade | Upgrade system OS |
apt install package XXX | apt-get install package XXX | Install package |
apt remove package XXX | apt-get remove package XXX | Remove package (leaves configuration files) |
apt purge package XXX | apt-get purge package XXX | Remove package and configuration files |
apt autoremove XXX | apt-get autoremove XXX | Remove package and unnecessary dependencies |
apt autoremove –purge | apt-get autoremove –purge | Remove packages, configurations, and unnecessary dependencies |
apt –reinstall install XXX | apt-get install –reinstall XXX | Reinstall packages |
apt-get check | Check for broken dependencies | |
apt-get -f install | Fix broken dependencies | |
apt clean | apt-get clean | Remove all packages from package cache |
apt autoclean | apt-get autoclean | Remove packages for uninstalled programs from package cache |
apt search XXX | apt-cache search XXX | Search package cache for XXX |
apt show XXX | apt-cache show XXX | |
apt list –installed | dpkg –get-selections | grep -v deinstall | List installed packages |
apt list –installed | dpkg -l | List installed packages |
apt edit-sources | echo ‘new line of text’ | sudo tee -a /etc/apt/sources.list | Add a new package source |
apt edit-sources | sudo nano /etc/apt/sources.list | Add a new package source |
apt depends XXX | apt-cache XXX | Find package dependencies (packages that XXX needs) |
apt rdepends XXX | apt-rdepends XXX | Find reverse dependencies (packages that need XXX) |
apt policy XXX | apt-cache policy XXX | Set package update policy |
apt held | dpkg –get-selections | grep hold | List packages with prevented ugprades |
apt hold XXX | echo XXX hold | sudo dpkg –set-selections | Prevent upgrade of package |
apt unhold XXX | echo XXX install | sudo dpkg –set-selections | Remove hold on package upgrade |
apt list –upgradable (sudo not required) | apt-get -u upgrade –assume-no (sudo required) | List upgradeable packages |
aptitude show XXX | Get package description | |
apt-cache show XXX | ||
dpkg -p XXX | Get package description | |
aptitude why XXX | Detail packages dependent on XXX | |
dpkg -S
|
Searches for package dependent containing XXX filename |
Sources: