Comparing the apt-get and aptitude package tools

Slashdot it! Delicious Share on Facebook Tweet! Digg!

Colorful Mix

You will attract errors and add confusion if you alternately use apt-get and aptitude – for example, if you install Package A with aptitude, then use apt-get to remove Package A, and the install Package B, again with aptitude.

In the first step, aptitude sets up any actions and installs Package A. In the second step, apt-get deletes Package A without aptitude knowing anything about it, so aptitude assumes the package is still installed. In the last step, aptitude installs package B along with package A, again because package A is in the list of packages to be installed by aptitude. Package B is considered "lost" by aptitude and therefore needs to be set up again for installation.

Conversely, the same would not occur. Aptitude doesn't remove a package installed by apt-get behind its back because the software considers it "installed" in its list. This behavior belongs to the group of bugs centered around holds between aptitude and dpkg/dselect [8]. To avoid the trouble, it's best to decide on one of the package managers and stay with it.

This detail especially gains in importance when software in an APT repository indicates that it should be installed via aptitude install package_name . This call might potentially install the package, but it can also drag along all of aptitude's scheduled package actions  – which is not always the developer's intention. The same danger might not exist with apt-get install package_name .

Conclusion

Apt-get and aptitude are command-line package managers for Debian-based systems, including Ubuntu and its many variants. If you are growing weary of the Software Center and prefer to work from the command line, either apt-get or aptitude will do the job – but don't try to use them both. Whether you adopt apt-get or aptitude is entirely your decision and has nothing to do with the software you wish to install.

Table 1

Apt-get and Aptitude Subcommands

Action Apt-get Aptitude
Update package lists update update
Conservatively update packages upgrade safe-upgrade
Update all packages dist-upgrade full-upgrade
Install package install package_name install package_name
Re-install package install --reinstall package_name reinstall package_name
Remove package remove package_name remove package_name
Remove package plus configuration files purge package_name purge package_name
Remove unused package autoremove -
Hold package Not available (1) hold package_name
Empty package cache (completely) clean clean
Delete all available sources autoclean autoclean
Show package information show (2) show package_name
Show why package installed - why package_name
Show why package not installed - why-not package_name
Show dependency errors check search '~b'
Search for package search (2) search pattern
Show available package versions policy (2) versions package_name
(1) via dpkg-hold package_name . (2) via apt-cache (also in package apt).

The Author

Axel Beckert (http://noone.org/abe/) was once a computer science major and biology minor at the University of Saarland. He now works as a Linux system administrator at ETH Zurich, is on the board of directors of the Linux User Group Switzerland, and is a member of the Debian Project. He's been using aptitude for more than 10 years and is a mentor, guinea pig, and package sponsor since the restructuring of the aptitude team.

Frank Hofmann studied at the Technical University of Chemnitz. He currently works in Berlin at Büro 2.0 (http://www.buero20.org/), an open source expert network, as a service provider specializing in print and layout (http://www.efho.de/). He is co-founder of the training company Wizards of FOSS (http://www.wizards-of-foss.de/). Since 2008, he has coordinated the regional Berlin-Brandenburg meeting of Linux User Groups.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content