Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?)

share|improve this question
    
I know its not the correct answerer for you question but why cant you try synaptic? its very user frindly and does download and install dependencies automatically. Is gnome is not present on your system? –  Hemant Aug 11 '10 at 7:12
    
I'm biased, but I think this question on the Ubuntu SE site might be relevant. –  David Z Aug 19 '10 at 7:38
5  
    
@Wim because of the wajig portion of this question I decided to merge 244 into this question instead of the other way around –  xenoterracide Sep 5 '10 at 20:44
1  
Its worth noting that aptitude is slated for removal from the default install on the next version of Ubuntu (although you could always install it using apt-get afterwards) –  Rob Cowell Feb 16 '11 at 12:47
add comment

9 Answers

up vote 111 down vote accepted

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.

share|improve this answer
    
One big issue I had with aptitude is that it takes a long time to get tab completions on package names (eg, aptitude install linux-im tab), while it is very fast for apt-get. There seems to be some caching present in the apt-get family that is lacking for aptitude. –  levesque Sep 11 '12 at 1:49
4  
aptitude also have the awesome aptitude search that you can use with very powerful search patterns. You have aptitude reinstall. You can also use the ncurses (terminal menu) interface to prepare complex package operations like partial upgrade, remove one package, freeze another one, upgrade this one, that you can then execute in a single operation... Oh, and it has an interactive conflict resolver. –  Totor Mar 21 '13 at 23:52
1  
@Totor holy cow, using aptitude's ncurses interface to prepare commands just sold me on aptitude once and for all! (after years of thinking aptitude is worth doing, but typing apt-get from muscle memory) –  TJ Ellis Oct 16 '13 at 16:19
1  
...and aptitude also has aptitude download package-name to get the package .deb file! –  Totor Oct 18 '13 at 14:44
    
It's just one thing I have found that isn't in aptitude but are in apt-get, and that is apt-get --compile source package-name. apt-get build-dep package-name exist but I think that aptitude build-dep package-name do a better job. –  Anders Mar 10 at 14:13
add comment

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
         (__) 
         (oo) 
   /------\/ 
  / |    ||   
 *  /\---/\ 
    ~~   ~~   
...."Have you mooed today?"...
gaurav@fern:~$ aptitude moo
There are no Easter Eggs in this program.
share|improve this answer
28  
No! aptitude has more. You forgot to put the endless -v flags to moo. (You can go upto -vvvvvv) –  Umang Aug 19 '10 at 6:51
    
o.O! Brilliant. –  Gaurav Aug 19 '10 at 9:52
5  
Don't forget the all important Super Cow Powers, which apt-get has but aptitude does not. (Try --help on both) –  derobert Aug 20 '10 at 18:51
add comment

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: http://www.debian.org/doc/FAQ/ch-pkgtools.en.html#s-aptitude

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

share|improve this answer
2  
The release notes say apt-get is now recommended over aptitude for upgrades to squeeze. –  jrdioko Feb 9 '11 at 19:55
    
Yes, but only for that. Otherwise they are considered equal but aptitude has a lot of more advanced features, like search and full screen mode, than apt-get. –  Anders Mar 10 at 14:18
    
For some reason used aptitude to install emacs and without looking it removed gdm! So for the now will be using apt-get but am very curious of aptitude. –  TomFirth Mar 26 at 8:18
add comment

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.

share|improve this answer
2  
This used to be true, but I know my apt-get has an apt-get autoremove command for removing packages installed only as dependencies. I don't know when this feature was added, but one website suggests it might have happened with Debian Lenny (June 2010). –  Gaurav Aug 19 '10 at 10:55
4  
apt-get autoremove doesn't remove packages installed only as dependencies, it removes orphaned dependencies, which is a subtle difference; it can't tell whether a 'leaf' package was installed with intent or as a dependency so it leaves it, where aptitude would know and remove it. –  pjz Aug 19 '10 at 15:05
add comment

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: http://ubuntu.stackexchange.com/questions/1743/is-aptitude-really-better-than-apt-get/1749#1749

share|improve this answer
    
They are pretty similar, I can switch between them easy enough. –  invert Aug 11 '10 at 8:48
add comment

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? Yes.

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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 problems.)

  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 package.

-- see shy jo

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.