Aptitude vs Apt-get Comparison

see also: Interactive, Full Screen Aptitude

One of the many attractive features of Ubuntu and Debian Linux is the package management system. Coming from other operating systems and other distributions makes the discovery of the Advanced Packaging Tool, APT, a source of pleasure and delight. Here is a system that solves dependency hell, makes keeping soft up to date easy and facilitates simple installation and removal of software packages.

The mainstay of this system has been apt-get, an extremely useful and versatile program that has been the heart of the Debian APT system. A great and useful program, but not perfect, the newer program aptitude is the result of an effort to improve on apt-get. In addition to a cleaner command line interface, aptitude offers a fullscreen character-based UI and more complete tracking of what has been installed and interdependencies.

aptitude is a newer and improved replacement for apt-get

These two programs provides higher level capabilities compared to dpkg, the Debian low-level package management utility. They offer an interface to package repositories and provide relief from dependency hell.

feature apt-get command aptitude command
fullscreen interface N/A aptitude
install package apt-get install ‘pkgname’ aptitude install ‘pkgname’
remove package apt-get remove ‘pkgname’ aptitude remove ‘pkgname’
purge package (removes package
and installation files)
apt-get –purge remove ‘pkgname’ aptitude purge ‘pkgname’
upgrade installed packages apt-get upgrade aptitude upgrade
upgrade installed packages
even if other packages
must be removed
apt-get dist-upgrade aptitude dist-upgrade
show package details (apt-cache show ‘pkgname’) aptitude show ‘pkgname’
search for packages (apt-file ‘searchpattern’) aptitude search ‘searchpattern’
delete installation files apt-get clean aptitude clean
delete obsolete installation files apt-get autoclean aptitude autoclean
update local cache of
available packages
apt-get update aptitude update
Show package details apt-get show ‘pkgname’ aptitude show ‘pkgname’
Retain the current version
of a package going forward
N/A aptitude hold pkgname
Clear the hold on a
package from
‘aptitude hold pkgname’ command
N/A aptitude unhold pkgname
List reverse dependencies apt-cache rdepends packagename aptitude -D packagename
super cow powers apt-get moo aptitude -v[v[v[v[v]]]] moo

As you can see, in addition to a more complete dependency tracking solution, aptitude also provides a (well designed) full-screen interface and cleaned-up command line syntax. Also, contrary to reports elsewhere, aptitude offers the ever important super cow functionality, with sarcasm added (Easter egg).

When installing a package, aptitude will show which other packages, though not required, are recommended or suggested, so you can decide whether or not to also install those.

Because aptitude more completely track dependencies, if you use it exclusively your will not need to use deborphan or debfoster.

Apt-get does not remove packages it installed as dependencies when the package you specified to be installed is removed. Aptitude does remove unneeded dependencies. This basic difference can cause problems when switching from apt-get to aptitude.

Don’t use both apt-get and aptitude interchangeably

Use one or the other. I’ve switched completely from using apt-get to using aptitude. If you do use apt-get, afterward run aptitude and fix any problems detected by first pressing g, which will show broken dependencies and packages that aptitude would remove. If you want to retain the packages that would be removed, arrow down to the header of that category and press the + key. Pressing g again will update your system with your indicated changes.

There is a difference in how aptitude keeps track of installed packages and their dependencies compared to apt-get. Aptitude is more precise is tracking these dependencies. Consequently, when you switch from using apt-get to aptitude, the first time you use aptitude you can run into problems because it can remove needed packages because it does not know that they are needed. This can be resolved through aptitudes’s full-screen interface or by entering the following command:

sudo aptitude keep-all

This will cause aptitude to retain all current packages going forward.

Aptitude’s full-screen interface

As displayed in the comparison table, aptitude offers a character-based full-screen interactive user interface if aptitude is entered as a command with no options.

The interface is very well designed and implemented, logical and easy to use after a few minutes of examination and trial. It has a drop-down menu system, which I found to work well using a mouse. The help system can be access via the drop-down menu or by pressing the ‘?’ key. A plethora of options are presented, most of which will make sense from what you’ve seen in the command line operation of the program. Pressing ‘q’ exits help…indeed pressing ‘q’ is the way to exit other modes in the program and exiting the program itself.

Other thoughts

I’ve found aptitude to be so well done, that I use it for all my package management needs. I use Synaptic to help search for software sometimes, whether for my local machine or a server. Then, I install it with aptitude…in any case Synaptic would be pretty useless over SSH to a server.

Some pages I found helpful: http://pthree.org/2007/08/12/aptitude-vs-apt-get/ and http://www.garfieldtech.com/blog/your-debian-aptitude.

Be Sociable, Share!

8 thoughts on “Aptitude vs Apt-get Comparison

  1. Thanks – that is a very useful table (not just for comparing the two programs, but also for remembering their commands).

  2. this information is very old… infact it wasnt even correct when it was posted… apt-get has tracked dependencies for some time now and will let you remove orphaned dependencies using apt-get autoremove…

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>