What's the difference between apt-get and aptitude?

I don't get why there are two different programs in a minimal install to install software. Don't they do the same thing? Is there a big difference? I have read everywhere to use aptitude over apt-get but I still don't know the difference


aptitude is a wrapper for dpkg just like apt-get/apt-cache, but it is a one-stop-shop tool for searching/installing/removing/querying. A few examples that apt might not supply:

$ aptitude why libc6
i   w64codecs Depends libc6 (>= 2.3.2)
$ aptitude why-not libc6
Unable to find a reason to remove libc6.

$ aptitude show libc6
Package: libc6
State: installed
Automatically installed: no
Version: 2.9-4ubuntu6
Priority: required
Section: libs
Maintainer: Ubuntu Core developers <[email protected]>
Uncompressed Size: 12.1M
Depends: libgcc1, findutils (>= 4.4.0-2ubuntu2)
Suggests: locales, glibc-doc
Conflicts: libterm-readline-gnu-perl (< 1.15-2), 
tzdata (< 2007k-1), tzdata-etch, nscd (< 2.9)
Replaces: belocs-locales-bin
Provides: glibc-2.9-1
Description: GNU C Library: Shared libraries
 Contains the standard libraries that are used by nearly all programs 
 on the system. This package includes shared versions of the standard 
 C library and the standard math library, as well as many others.

mikeage@linode ~$ aptitude -h | tail -n 1
              This aptitude does not have Super Cow Powers.
mikeage@linode ~$ apt-get -h | tail -n 1
                   This APT has Super Cow Powers.
mikeage@linode ~$ aptitude moo
    There are no Easter Eggs in this program.
mikeage@linode ~$ apt-get moo
         (__)
         (oo)
   /------\/
  / |    ||
 *  /\---/\
    ~~   ~~
...."Have you mooed today?"...
mikeage@linode ~$ aptitude -v moo
There really are no Easter Eggs in this program.
mikeage@linode ~$ aptitude -vv moo
Didn't I already tell you that there are no Easter Eggs in this program?
mikeage@linode ~$ aptitude -vvv moo
Stop it!
mikeage@linode ~$ aptitude -vvvv moo
Okay, okay, if I give you an Easter Egg, will you go away?
mikeage@linode ~$ aptitude -vvvvv moo
All right, you win.

                               /----\
                       -------/      \
                      /               \
                     /                |
   -----------------/                  --------\
   ----------------------------------------------
mikeage@linode ~$ aptitude -vvvvvv moo
What is it?  It's an elephant being eaten by a snake, of course. 

The official tool that is currently used within the Debian installer and recommended in the release notes is aptitude.

Aptitude offers a curses interface (when run without any parameter) and a command line interface that can do almost everything that apt-cache/apt-get does. It also has a better dependency resolver that let you browse between multiple solutions. Even when using the command line version, you can interact with the proposed solution and give supplementary orders or hints (like installing or removing a package that is recommended by another one).

But aptitude is based on the libapt library (it's not a direct wrapper of dpkg) and as such it depends on the apt package so you can't have aptitude installed without apt-get (which is also in the apt package).

$ dpkg --status aptitude| grep Depends
Depends: libapt-pkg-libc6.9-6-4.7, [...]
$ dpkg --status apt|grep Provides
Provides: libapt-pkg-libc6.9-6-4.7
$ dpkg --search /usr/lib/libapt-pkg-libc6.9-6.so.4.7 /usr/bin/apt-get
apt: /usr/lib/libapt-pkg-libc6.9-6.so.4.7
apt: /usr/bin/apt-get

To learn more on how apt/dpkg/aptitude interact you can check the diagram made by Daniel Burrows (aptitude's main author). Another diagram presents the information stored by the various package management tools: A map of the apt and dpkg state files.

You can also read my article apt-get, aptitude, … pick the right package manager for you