What is the real difference between "apt-get" and "aptitude"? (How about "wajig"?)

I know that both apt-get and aptitude are command line package management interfaces on Debian derived Linux, with different options, but I’m still somewhat confused. Under the hood, aren’t they using the same APT system?

Why does Debian maintain these parallel tools? (Bonus question: what on earth is wajig?)

Asked By: Kevin Cantu


aptitude is the preferred program for package management from console both for package installations and package or system upgrades in Debian.

Here is an overview of the tool and the features it has over apt-get:

So, my advice is to just apt-get install aptitude 🙂

Answered By: dsp

They offer the same basic functionality: install and remove packages from the command-line.

Here’s a more detailed comparison, posted on the Ubuntu Stack Exchange website: https://askubuntu.com/questions/1743/is-aptitude-really-better-than-apt-get/1749#1749

Answered By: Riccardo Murri

I’ve often wondered myself. Wikipedia highlights that the main distinguishing feature is that aptitude has a full screen text-mode (curses) interface. The fact that you can use most apt-get command arguments with aptitude itself is just a design decision to make it easier for apt-get users to move to aptitude and vice-versa.

I’ve never used wajig, but the documentation suggests that it’s just a script which knows whether you’re passing it a deb file (when it runs dpkg) or an apt package name (when it runs apt-get instead). Could you try it out and see if that is what it does?

Of course, the real difference is:

gaurav@fern:~$ apt-get moo
  / |    ||   
 *  /---/ 
    ~~   ~~   
...."Have you mooed today?"...
gaurav@fern:~$ aptitude moo
There are no Easter Eggs in this program.
Answered By: Gaurav

aptitude remembers which packages were explicitly requested and which were only installed due to dependencies. It will automatically uninstall packages which were not explicitly requested when they are no longer needed.

apt-get treats packages requested explicitly and their dependencies the same.

So better use aptitude, this helps to keep your system clean.

Answered By: starblue

As mentioned be http://pthree.org/2007/08/12/aptitude-vs-apt-get/, aptitude has a much easier to use command-line interface.

Under the hood, aren’t they using the same APT system?

The underlying system is not just apt, but dpkg. This system is just as dumb as RPM, it can only handle the installation and administration of single packages. It tracks which installed files belong to which package.

apt handles the downloads of repositories, tracking of dependencies, and so on for all individual packages – which it then installs using dpkg. aptitude does the same, with a different interface.

Answered By: vdboor

The most obvious difference is that aptitude provides a terminal menu interface (much like Synaptic in a terminal), whereas apt-get does not.

Considering only the command-line interfaces of each, they are quite similar, and for the most part, it really doesn’t matter which one you use. Recent versions of both will track which packages were manually installed, and which were installed as dependencies (and therefore eligible for automatic removal). In fact, I believe that even more recently, the two tools were updated to actually share the same database of manually vs automatically installed packages, so cases where you install something with apt-get and then aptitude wants to uninstall it are mostly a thing of the past.

There are a few minor differences:

  • aptitude will automatically remove eligible packages, whereas apt-get requires a separate command to do so
  • The commands for upgrade vs. dist-upgrade have been renamed in aptitude to the probably more accurate names safe-upgrade and full-upgrade, respectively.
  • aptitude actually performs the functions of not just apt-get, but also some of its companion tools, such as apt-cache and apt-mark.
  • aptitude has a slightly different query syntax for searching (compared to apt-cache)
  • aptitude has the why and why-not commands to tell you which manually installed packages are preventing an action that you might want to take.
  • If the actions (installing, removing, updating packages) that you want to take cause conflicts, aptitude can suggest several potential resolutions. apt-get will just say "I’m sorry Dave, I can’t allow you to do that."

There are other small differences, but those are the most important ones that I can think of.

In short, aptitude more properly belongs in the category with Synaptic and other higher-level package manager frontends. It just happens to also have a command-line interface that resembles apt-get.

Bonus Round: What is wajig?

Remember how I mentioned those "companion" tools like apt-cache and apt-mark? Well, there’s a bunch of them, and if you use them a lot, you might not remember which ones provide which commands. wajig is one solution to that problem. It is essentially a dispatcher, a wrapper around all of those tools. It also applies sudo when necessary. When you say wajig install foo, wajig says "Ok, install is provided by apt-get and requires admin privileges," and it runs sudo apt-get install foo. When you say wajig search foo, wajig says "Ok, search is provided by apt-cache and does not require admin privileges," and it runs apt-cache search foo. If you use wajig instead of apt-get, apt-mark, apt-cache and others, then you’ll never have this problem:

$ apt-get search foo
E: Invalid operation search

If you want to know what wajig is doing behind the scenes, which tools it is using to implement a particular command, it has --simulate and --teaching modes.

Two wajig commands that I often use are wajig listfiles foo and wajig whichpkg /usr/bin/foo.

Answered By: Ryan C. Thompson

apt-get, as well as the various companion tools, use significantly less memory than respective command-line invocations of aptitude, and are a bit quicker. I was blissfully unaware of this until I tried upgrading the debian install on a wizened old pentium thinkpad with 32MB of ram. It would take an hour or two of swap-thrashing to run apt-get, which completed successfully; aptitude would fail after I think a longer period of time.

This distinction is more or less irrelevant on anything resembling a modern desktop system.

Answered By: intuited

Both apt-get and aptitude rely on the APT library, yes.

See my answer on serverfault.com.

Debian is not a monolithic entity, there are people with different opinions and the aptitude maintainer decided that apt-get had some shortcomings and wanted to build something better with aptitude. He improved the logic to find solutions for complex upgrade scenarios, added a GUI for the console, etc. And there’s more than just apt-get and aptitude, see my article apt-get, aptitude, … pick the right package manager for you.

Answered By: Raphaël Hertzog

I’m not sure if this still holds but the bleeding edge Debian developer Joey Hess always used to advocate aptitude over apt-get. Of course things to change as software evolves. Apt-get now handles dependencies better than it used to.
From http://lists.debian.org/debian-user/2004/04/msg03138.html

Date: Tue, 20 Apr 2004 22:27:12 -0400
From: Joey Hess

Nine reasons why you should be using aptitude instead of apt-get or dselect.

  1. aptitude can look just like apt-get

    If you run ‘aptitude update’ or ‘aptitude upgrade’ or ‘aptitude
    install’, it looks and works just like apt-get, with a few enhancements.
    So there is no learning curve.

    (If you’re a dselect user, learning curve is obviously not one of your

  2. aptitude tracks automatically installed packages

    Stop worrying about pruning unused libraries and support packages from
    your system. If you use aptitude to install everything, it will keep
    track of what packages are pulled in by dependencies alone, and remove
    those packages when they are no longer needed.

  3. aptitude sanely handles recommends

    A long-standing failure of apt-get has been its lack of support for
    the Recommends relationship. Which is a problem because many packages
    in Debian rely on Recommends to pull in software that the average user
    generally uses with the package. This is a not uncommon cause of
    trouble, even though apt-get recently became able to at least mention
    recommended packages, it’s easy to miss its warnings.

    Aptitude supports Recommends by default, and can be confgigured to
    support Suggests too. It even supports installing recommended packages
    when used in command-line mode.

  4. use aptitude as a normal user and avoid hosing your system

    Maybe you didn’t know that you can run aptitude in gui mode as a regular
    user. Make any changes you’d like to try out. If you get into a real
    mess, you can hit ‘q’ and exit, your changes will not be saved.
    (Aptitude also lets you use ctrl-u to undo changes.) Since it’s running
    as a normal user, you cannot hose your system until you tell aptitude to
    do something, at which point it will prompt you for your root password.

  5. aptitude has a powerful UI and searching capabilities

    Between aptitude’s categorical browser and its great support for
    mutt-style filtering and searching of packages by name, description,
    maintainer, dependencies, etc, you should be able to find packages
    faster than ever before using aptitude.

  6. aptitude makes it easy to keep track of obsolete software

    If Debian stops distributing a package, apt will leave it on your system
    indefinitly, with no warnings, and no upgrades. Aptitude lists such
    packages in its “Obsolete and Locally Created Packages” section, so you
    can be informed of the problem and do something about it.

  7. aptitude has an interface to the Debian task system

    Aptitude lets you use Debian’s task system as it was designed to be
    used. You can browse the available tasks, select a task for install, and
    then dig into it and de-select parts of the task that you don’t want.
    apt-get has no support for tasks, and aptitude is better even than
    special purpose tools like tasksel.

  8. aptitude supports multiple sources

    If your sources.list is configured to make multiple versions of a
    package available, aptitude lets you drill down to see the available
    versions and pick a non-default version to install. If a package breaks
    in unstable, just roll it back to the version in testing.

  9. aptitude logs its actions

    Aptitude logs package it installs, upgrades, and removes to
    /varlog/aptitude, which can be useful to work out why things started
    breaking after yesterday’s upgrade, or when you removed a partiticlar

see shy jo

there is also a newer discussion from 2010 here https://superuser.com/questions/93437/aptitude-vs-apt-get-which-is-the-recommended-aka-the-right-tool-to-use on StackExchange.

Answered By: manselton

Building on @Gaurav’s answer, the easter eggs in the two package managers are quite funny!:

siddhartha@siddhartha-dev:~$ apt-get  moo
      / |    ||   
     *  /---/ 
        ~~   ~~   
..."Have you mooed today?"...

siddhartha@siddhartha-dev:~$ aptitude  moo
There are no Easter Eggs in this program.
siddhartha@siddhartha-dev:~$ aptitude -v moo
There really are no Easter Eggs in this program.
siddhartha@siddhartha-dev:~$ aptitude -vv moo
Didn't I already tell you that there are no Easter Eggs in this program?
siddhartha@siddhartha-dev:~$ aptitude -vvv moo
Stop it!
siddhartha@siddhartha-dev:~$ aptitude -vvvv moo
Okay, okay, if I give you an Easter Egg, will you go away?
siddhartha@siddhartha-dev:~$ aptitude -vvvvv moo
All right, you win.

                     /                |
   -----------------/                  --------
siddhartha@siddhartha-dev:~$ aptitude -vvvvvv moo
What is it?  It's an elephant being eaten by a snake, of course.
siddhartha@siddhartha-dev:~$ aptitude -vvvvvvv moo
What is it?  It's an elephant being eaten by a snake, of course.
siddhartha@siddhartha-dev:~$ aptitude -vvvvvvvv moo
What is it?  It's an elephant being eaten by a snake, of course.

and so on.

Answered By: Siddhartha