Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Some time ago I read that aptitude is the preferred tool for installation on Debian-based systems. But when you search around on how to administer a Debian-based system, then aptitude is rarely mentioned. Most people seem to prefer apt-get - and that's even true for the Debian wiki pages!

Thus I am wondering if I have missed something. Which is the right tool to use?

share|improve this question
    
Interestingly Ubuntu no longer installs aptitude by default. –  Mechanical snail Aug 16 '12 at 0:35
2  
The single most important difference for me, is that after reading the docs thoroughly, I can find no way to get the source of a package via aptitude. apt-get source package-name will do it, but I've seen no aptitude equivalent –  EricR Sep 1 '12 at 7:10
1  
One thing is that aptitude search package-name works in aptitude. Another is aptitude why package-name is also useful but not in apt-get. I also thing that the command line of aptitude is a bit cleaned up compared to apt-get. But as you noticed, there are aptitude build-dep package-name but no aptitude source package-name. –  Anders Mar 10 at 13:48

5 Answers 5

aptitude and apt-get work the same for many tasks, but for the most tricky cases, such as distribution upgrades (apt-get dist-upgrade vs. aptitude full-upgrade), they have different rules, and aptitude's rules are nearly always better in practice where they disagree.

The reason you see more documentation for apt-get over aptitude is mostly inertia: aptitude has not been the recommended front end to APT for all that long, so much of the existing documentation hasn't been updated, and there are plenty of people who recognise the advantages of aptitude over apt-get but use apt-get reflexively.

I've recently got to the point where I usually follow apt with a iand not a - when I type.

Postscript Note that the rules used in apt-get and aptitude are moving targets - as Hubert notes in comments, the upgrade path recommended from Debian Lenny now uses apt-get, not aptitude. This reflects the fact that apt-get keeps track of less state about the current package than aptitude, and so does not need to worry about APT state not being "clean", and because apt-get rules are smarter than they used to be. I still use and recommend aptitude over apt-get, but it is a more nuanced recommendation

share|improve this answer
6  
In addition to that, aptitude allows to browse through possible resolutions of conflicts easily, whereas with apt-get you usually have only one possible way shown and either you accept it or you have to do resolution by hand (f.e. using dpkg). –  liori Feb 26 '10 at 23:13
13  
apt-get does have the advantage of being more memory-efficient. This is unlikely to be noticeable for most users; I wasn't really aware of it until I tried to upgrade packages on a full Debian install with 32MB of RAM. aptitude ended up thrashing in swap for about an hour per run; apt-get was significantly faster. –  intuited Jun 30 '10 at 19:22
    
@intuited: Good to know, thanks. –  Charles Stewart Jun 30 '10 at 20:11
4  
The official Debian squeeze documentation explicitly states not to use aptitude for upgrade from Lenny even though it was supported for previous upgrades, so I don't think it's only inertia... –  Hubert Kario Aug 15 '12 at 23:56
    
@HubertKario - Yes, indeed. I've updated my answer. –  Charles Stewart Aug 30 '12 at 9:51

original content:

aptitude makes it convenient to show what programs in a search you already have installed >on the system (with the help of grep)

> aptitude search flash | grep ^i

Actually, aptitude's search is far more powerful than what you get piping through grep, as it supports contextual searching:

e.g.

finds all packages with 'flash' in the package name that are installed. aptitude search ~iflash

an equivalent "long form" of the "short form" ~i. aptitude search '?installed(flash)'

note that search patterns are free by default. to anchor them, you need to use anchor patterns '^' (beginning of string) and/or '$' (end-of-string)

To find all packages whose names start with either 'ttf' or 'font':

aptitude search '(^ttf|^font)'

(note: this is a workaround to a bug in aptitude, as the correct regex of '^(ttf|font)' does not work properly -- it finds packages whose names start with 'ttf' or contain 'font')

Other nifty aptitude features:

Show all packages with 'firmware' in their name that ALSO have 'wireless' in their description

# aptitude search 'firmware ~dwireless'

-or- longform: [ aptitude search '?and(?name(firmware),?description(wireless))' ] (note in shortform space-delimited arguments are ANDed within quotes, if passed as separate argv[] commandline arguments they are ORed) p atmel-firmware - Firmware for Atmel at76c50x wireless networking chips. p firmware-atheros - Binary firmware for Atheros wireless cards ... p libertas-firmware - Firmware for Marvell's libertas wireless chip series p zd1211-firmware - Firmware images for the zd1211rw wireless driver

shows all packages that are Upgradeable from their current versions with new versions

# aptitude update ; aptitude versions ~U
Package virtualbox-4.1:            
i   4.1.18-78361~Debian~squeeze                       100
p   4.1.20-80170~Debian~squeeze     <NULL>            500

Show packages that Recommend 'gcc-multilib'

$ aptitude search '~DRecommends:gcc-multilib'
i   libc6-dev-i386   - Embedded GNU C Library: 32-bit development libraries for AMD64

Explain why 'fuse-utils' might need to be installed

$ aptitude why fuse-utils
i   xorg           Depends    xterm | x-terminal-emulator
pi  gnome-terminal Provides   x-terminal-emulator
pi  gnome-terminal Recommends gvfs
pi  gvfs           Depends    libgdu0 (>= 2.29.90)
pi  libgdu0        Depends    udisks (< 1.1.0)
pi  udisks         Recommends ntfsprogs
pi  ntfsprogs      Depends    fuse-utils (> 2.5.0)

(This example shows some of the craziness resulting from the default since Squeeze(?) of installing all "Recommends" packages. installing gnome-terminal ends up installing ntfsprogs and fuse-utils, egad! I think most folks just want the terminal perspective and not the builtin NTFS integration, which is optional, unless they specified it)

find all packages that provide the service "mail-transport-agent"

$ aptitude search '?provides(mail-transport-agent)'
p   citadel-mta          - complete and feature-rich groupware server (mail transport agent)
..
p   nullmailer           - simple relay-only mail transport agent
p   postfix              - High-performance mail transport agent
i   sendmail-bin         - powerful, efficient, and scalable Mail Transport Agent
p   ssmtp                - extremely simple MTA to get mail off the system to a mail hub
p   xmail                - advanced, fast and reliable ESMTP/POP3 mail server

show all package names that are installed, that are not either Essential or Automatically installed by dependencies

$ aptitude search '~i!(~E|~M)' -F '%p'

Unfortunately, this stuff is rather poorly documented and hard to find, but here's the best reference (from the 'aptitude' maintainer) http://algebraicthunk.net/~dburrows/projects/aptitude/doc/en/ch02s03s05.html#tableSearchTermQuickGuide

share|improve this answer
4  
Search features are available from apt-get via apt-cache search NAME –  EricR Sep 1 '12 at 7:09

According to the Debian GNU/Linux FAQ about package management, aptitude is more complex than apt-get and depends on the less complex package management tools apt-get and dpkg.

Therefore, for simpler needs, you can use the simpler tools, while for more complex needs, you can count on the more sophisticated tool (apitude).

Quoted from the Debian FAQ: "aptitude provides the functionality of dselect and apt-get, as well as many additional features not found in either program."

share|improve this answer

aptitude marks packages which where installed because of a dependency with the auto tag. If you now purge or remove a package, aptitude will automatically remove the auto installed packages which aren't used anymore alongside the package you want to purge or remove.

This is the main reason why I personally think that aptitude is always better then apt.

share|improve this answer
    
Citation needed, but that would be a compelling difference. –  Kzqai Sep 9 '13 at 15:15
    
Citation: debian-handbook.info/browse/stable/… –  deizel Sep 10 '13 at 18:55
    
Actually apt-get does that as well, with apt-get autoremove <package-name>. Both apt-get and aptitude mark auto-installed packages –  Legionair Jan 14 at 18:05
    
But aptitude do clean up auto packages each time it's used. While apt-get you need to start that explicit. –  Anders Mar 10 at 14:02

There's no right tool, you can mix & match both depending on the one that you find most convenient for the task at hand. aptitude is a great tool for testing/sid users but it tends to be less reliable for dist-upgrading from one stable to the next. See my article apt-get, aptitude, … pick the right package manager for you.

share|improve this answer

protected by Nifle Sep 1 '12 at 4:29

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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