Being an Ubuntu/Debian user (yes, I use and advocate both), I have fallen in love with the Advanced Packaging Tool, also known as apt. Before Ubuntu, I played in the world of RPM hell, with distros such as Red Hat itself, Mandrake (as it was called back then), and even SuSE. I would find some piece of software, try to install it, only to find that it would choke, saying that it relied on some certain dependencies. I would install the dependencies, only to find conflicting versions with newer software. Hell indeed. So when I discovered the Debian way of installing software, I wondered why no one had mentioned it to me before. It was heaven. This is the way to software, I thought.
So, as any new user to the world of apt learns, apt-get is the way to install software in your system. After working on a Debian-based system that uses apt, such as Ubuntu, you also learn the various tools:
- apt-get: Installing and removing packages from your system, as well as updating package lists and upgrading the software itself.
- apt-cache: Search for packages in the package list maintained by apt on the local system
- dpkg- Used for various administrative tasks to your system, such as reconfiguring Xorg.
Those are probably the first few tools that you learn while on a Debian-based distro, if you plan on getting down and dirty at any length. But the buck doesn’t stop there. You need to memorize, and learn other tools, if you are to further administrate your system. These include:
- apt-listbugs: See what bugs are listed on a software package before you install it.
- apt-listchanges: Same thing as apt-listbugs, but for non-bug changes.
- apt-rdepends: Tool for viewing dependency trees on packages.
- deborphan- Look for orphaned dependencies on the system left from removing parent packages.
- debfoster- Helps deborphan identify what package dependencies you no longer need on your system.
- dselect- Curses interface for viewing, selecting and searching for packages on your system.
There’s even more: apt-cdrom, apt-config, apt-extracttemplates, apt-ftparchive, apt-key, apt-mark and apt-sortpkgs.
If any of you have noticed, that is 16 different tools that you need to become familiar with, if you are to start learning about your Debian-based distro. I don’t know about you, but doesn’t that seem a bit bass-ackwards? I mean, when I’m using OpenSSH, for example, other than scp, all of the functionality of OpenSSH is filed under one tool: ssh. So, wouldn’t you think that all the functionality of apt would be under one tool, namely just ‘apt’?
Further more, apt-get has a big problem that hasn’t really been addressed until only just recently. The problem is in removing packages. You see, apt-get does a great job of indentifying what dependencies need to be installed when you want a certain package, but it fails miserably when you want to remove that package. If dependencies were required, ‘apt-get remove’ will remove your packages, but leave orphaned dependencies on your system. Psychocats.net has a great writeup on this very phenomenon, by simply installing and removing the package kword. The solution? Aptitude.
Now, before I continue, I want to say that yes, I am aware of ‘apt-get autoremove’ finally being able to handle orphaned dependencies. This is a step in the right direction, for sure. However, apt-get, with its many other tools, is an okay way of doing things, if you like to learn 16 different tools. Aptitude, as I will show you, is one tool for them all.
Aptitude is the superior way to install, remove, upgrade, and otherwise administer packages on you system with apt. For one, since it’s inception, aptitude has been solving orphaned dependencies. Second, it has a curses interface that blows the doors off of dselect. Finally, and most importantly, it takes advantage of one tool, doing many many functions. Let’s take a look:
- aptitude: Running it with no arguments brings up a beautiful interface to search, navigate, install, update and otherwise administer packages.
- aptitude install: Installing software for your system, installing needed dependencies as well.
- aptitude remove: Removing packages as well as orphaned dependencies.
- aptitude purge: Removing packages and orphaned dependencies as well as any configuration files left behind.
- aptitude search: Search for packages in the local apt package lists.
- aptitude update: Update the local packages lists.
- aptitude upgrade: Upgrade any installed packages that have been updated.
- aptitude clean: Delete any downloaded files necessary for installing the software on your system.
- aptitude dist-upgrade: Upgrade packages, even if it means uninstalling certain packages.
- aptitude show: Show details about a package name.
- aptitude autoclean: Delete only out-of-date packages, but keep current ones.
- aptitude hold: Fix a package at it’s current version, and don’t update it
Are we starting to see a pattern here? One command with different readable options (no unnecessary flags). And that’s just the tip of the ice berg. It gets better. For example, when searching for a package using aptitude, the results are sorted alphabetically (gee, imagine that) and justified in column width format. Heck, it will even tell you which one you have installed on your system already, instead of haphazardly listing the packages in some random, unreadable format, like apt-cache.
I’ve already mentioned it, but aptitude run with no options will pull up a curses application for you to navigate your apt system. If any of you have used it, you know that it is far superior to dselect- talk about a shoddy application. Aptitude makes searching for packages, updating them, removing them, getting details and other necessary tools, easy. Spend 20 minutes inside the console, and you begin to feel like this is an application done right. Spend 20 minutes in dselect, and you’ll begin to get massive headaches, and feel lost inside Pan’s Labyrinth.
Aptitude is just superior to apt-get in every way, shape, and form. Better dependency handling. Better curses application. Better options. ONE tool. Better stdout formatting. The list goes on and on. I see constantly, on forums, IRC and email, the use of apt-get. We need to better educate our brethren and sisters about the proper use of tools, and show them the enlightened way of aptitude. I’ve been using aptitude since I first learned about it, ad will continue to do so the remainder of my Debian/Ubuntu days.
Thanks to GarfieldTech for the inspiration of this post.
Lean aptitude. Use aptitude.

{ 50 } Comments
Uh, Synaptic?
Use wajig, a small Python wrapper around apt-*, dpkg, aptitude (yes indeed) and a number of other tools. It even calls sudo for you when needed so you only ever need wajig itself. Has quite some help as well. Try it, and you may like it.
Dirk, who maintains wajig in Debian and is therefore not unbiased
@Alex Jones- You run into the same problems with Synaptic that you do with apt-get remove, namely, that it will not remove orphaned dependencies. Further, Synaptic does very little compared to aptitude. It’s a nice GUI front-end of apt for the lay user, but that’s about it. Synaptic doesn’t do much for you on a remote server with no X either.
@Dirk- Nah, aptitude is exactly what I want in a package management tool, providing me with everything I need, and plugging the holes of apt-get. Thanks though.
The command line interface of aptitude is very well done. But the curses interfaces is made bey a vi-fan, judging by how weird and especially stateful it is. If you love vi(m), you’ll love aptitude, but if you like me find that vim is best forgotten, you might to use another GUI frontend
But it *is* the best command line interface to debian repositories. If I want a GUI, I use Adept. (No limiting Gnome for me, thanks
)
@Esben- Whether it was written by a vi enthusiast or not, makes little sense, as aptitude resembles very little to vi or vim. Being a curses-based application, it needs to be powered by the keyboard, and leaning the keyboard shortcuts only takes a few minutes. I use both vim and aptitude heavily, and other than the fact that they are both keyboard driven, I see little or no similarities.
Using SUSE for a few years, at one point I had decided package managemenet was the worst thing about Linux. With Debian and such, I’ve decided that it’s the best.
I use apt-get/apt-cache daily, but when conflicts arise, I switch to aptitude and its superior conflict resolution
I use select, but most likely because I started using it in 1995. :^) It works for me, but I certainly do recommend aptitude to those who are new to Debian.
I guess I’ll give aptitude another try, to see how it’s “orphan” system works. My daily work machine is a continuously updated Debian Unstable, so it does tend to accrue obsolete libraries.
If aptitude is really that better than apt-get, it’s a pity that, when you type a command from a non installed package in the command line, it suggest to ‘apt-get’ it. It’s a really great feature (since feisty) but it should mentione aptitude IMO
The only thing I go back to apt-get consistently is for the function of “apt-get source”. I haven’t found myself wiggling any way around that one, yet. Besides that, aptitude just rocks!
Hi I read a tons of pro and cons apt-get/ aptitude info through forums etc…
And I wonder if I could use aptitude after half a year of apt-get use. Does aptitude can remove dependencies of software installed by apt-get ?
And if some consitency problems could arise.
@Lucky: No. It must be installed by aptitude in order to remove the dependencies cleanly.
There are 2 more things I like about aptitude:
1. “Human-readable” logs in /var/logs/aptitude.log. If you’ve ever tried to see which packages you installed/removed/etc in dpkg.log, you’ll appreciate aptitude’s log.
2. aptitude search will list packages as well as their status, whether installed or not.
At the same time, however, aptitude lacks some of the power that the whole APT set of tools (all apt-*) provide. For example, aptitude does not have equivalents of these apt-cache options: madison, policy, depends, rdepends. I think aptitude doesn’t also have an equivalent of apt-file.
I think it would be safe to presume that APT is really “advanced”, in the sense that it does more than your basic package management. It’s a set of tools for both users and developers, novice and advanced. Aptitude presents the more commonly used options of APT.
Mimimiiiii~~~
http://www.youtube.com/watch?v=Jt8Q7Fsa_Vs
go cry, ranto-fags
Aptitude searching doesn’t work well. For example compare:
apt-cache search aggregator
aptitude search aggregator
Synaptic inter-operates with aptitude, in that either will auto-remove dependencies installed by the other. If you’ve been administering your system with other tools you need to clean it up by manually marking the packages that have been automatically by running
on each. Do this once and you can rest easy thereafter with assurance that you’ll have a clean system.This script will find all the packages that need to be installed because they are dependences. Remove the ones you want to be sure to have installed from the resultant list, and use
xargs aptitue -markauto to mark the rest as removable.join -v 1 -j 1Here are those script again, hopefully unmagled by the blog software:
join -v 1 -j 1 <(aptitude search ~i | cut -c 5- | cut -d " " -f 1 | sort) <(deborphan -a | awk ‘{print $2;};‘ | sort) | grep sambaI give up. The lack of a preview button has defeated me.
apt-spy ‘tests a series of Debian archive mirrors for bandwith. It writes an /etc/apt/sources.list with the fastest server.’
“I would find some piece of software, try to install it, only to find that it would choke, saying that it relied on some certain dependencies. I would install the dependencies, only to find conflicting versions with newer software.”
Guess you’ve never heard of yum….
@delicious- Uhhh… yum wasn’t around until about 2003. I’ve been involved with Linux before this. And by the time I had heard of yum, I was already using Ubuntu. So, I guess you’re right. I hadnt’ heard of something that didn’t exist, or wasn’t widely available.
@Aaron, Sorry I can kick it old school and mention yup or up2date, but comparing apt to rpm is as stupid as comparing dpkg to yum/yup/up2date.
That was my point — apples to apples comparisons are fair, even if some taste better than others.
@delicious- Well, I’m merely drawing a point, that RPM has no dependency resolution, and that because of this, I was pulling my hair out. When I met up with a package manager that finally did handle dependencies, it was heaven. It just happened to be that apt was the tool that I discovered before portage or yum. I will say, that it’s a sad distro that does not have a package manager that handles dependencies.
@Aaron, hell yeah it is sad. I remember dealing with that crap when I first started using Linux and it sucked. Those that use Linux now don’t know how good they’ve got it….
@Toby Kelsey
Use ~d
aptitude search ~daggregator
@Tim (and @Toby Kelsey)- Yes. When you execute ‘aptitude search’, aptitude assumes you are searching package names, not descriptions. As with every tool, you need to come to understand it fully, and what is being executed when you run it.
I’ve been using Debian for around 5 years now, and I’ve yet to see why aptitude is better. Maybe I’m old-fashioned. (I also don’t use Synaptic.)
Wow, the lack of a preview button really sucks. Anyway, the main point of my post was: “So the main difference between apt-get install packageX and aptitude install packageX is that aptitude will also install all of the packages that packageX recommends, which apt-get will merely mention them. Aptitude will also add those packages to its own database and remove them if you remove packageX.”
feta. Front End To Apt. and and most of the apt-* and d* tools.
http://packages.debian.org/cgi-bin/search_packages.pl?searchon=names&version=all&exact=1&keywords=feta
I’ve seen where using apt-get instead of the update manager in Ubuntu caused some issues, er rather update manager had better functionality in updating a system, uh and that would be a testing version. Not sure if aptitude would be an alternative. However, in Debian and aptitude is indeed a wonderful tool.
@Alex Chekholko
“aptitude -R install” will not install Recommends. This default behavior can be changed in aptitude’s setting, if I remember correctly. (Run plain “aptitude” for the curses GUI).
apt-get install foo* will install all packages that starts with foo. how do you do that in aptitude?
I’ve experienced the craziness of Mandrake urpm; now, in Ubuntu, I quickly began to prefer aptitude over apt-get, and pretty much support everything you have said. Supposedly apt-get has improved, but I still only use aptitude.
[ubuntu server edition, fluxbox]
@ Dirk Eddelbuettel:
Wajig really rocks!
@Alex,
As of October, apt-get in Sid automatically installs “recommends” as well, but it doesn’t gaim aptitude’s orphan handling.
I think the main cause of contention for the apt-* suite of tool might be based on the lack of ‘command argument tab completion’. It seems to me that when the apt-get tools where created the ‘-’ was used as a means of enabling one to preview/remember the set of tools that were availible with two hit of the tab key. In comparison, with aptitude you need to either remember or head straight to the man page (not that it a bad thing).
Fun tip: to purge all packages that have been removed but not purged, you can do this:
Now for my question: how would you do an
with aptitude? That’s the only thing I ever use apt-get for nowadays.This was a good article Aaron, thanks. I’ve always used apt-get (and friends) in the past, because I’d always thought that aptitude was ncurses interface only, and couldn’t easily figure out how to use it. You’ve gotten me to switch to aptitude (command-line use, anyway — not sure why I’d ever use the ncurses interface).
Btw, “iceberg” is one word, and also, the use of “bass-ackwards” was a bit cheesy.
Great article though.
I have to agree with Aaron’s first paragraph in full. RPM-based file systems were a huge impediment to my transition from Windows. At the time, I thought Ximian’s “Red Carpet” was my savior - a notion I have long since abandoned. Thanks for the great explanation of Aptitude!
Thanks, Matt, for the tip! I have been wondering how to do that myself without Synaptic.
Aaron, thanks a lot for the post! I had just recently started switching to Linux by installing a localized Slackware at work and at home. Slackware’s pkgtool doesn’t do any dependency checking by default, though thanks to the recency of installation this hasn’t become a problem (yet).
As for the computer at work, Slackware is just fine; but for the home notebook I decided to use some other distro, and the only two options I came up with are Debian and [K|X]ubuntu (still undecided which one, though).
In the light of my distro preference, your article was very timely.
Well I gave aptitude a try and could not get over this issue (Ubuntu Feisty):
Am I to stupid to use the search in aptitude or is it just broken?
@Geert Van Damme- Hopefully, that will be changed, but I doubt it. Because of apt-get and it’s grip on the Debian world of packages, it’ll probably be there for a while.
@Lucky- Aptitude will not remove dependencies installed by apt-get. You will need deborphan to remove those. From here on out, however, you can use aptitude to install and administer all of your packages.
@Jucto- I never question the advanced nature of apt-* tools. What I do question, is the sheer number of them, and their lack of any organization or structure. You need to use the tools that are best for the situation. I’m not saying aptitude replaces every apt tool in Debian-based systems, but it sure does beat a great deal of them. That’s all.
@Anonymous- Thanks for the quality comment keeping on topic to the discussion at hand.
@Matt- Very nice tip. I was unaware of that. I wonder how many packages I have removed, but haven’t purged…
@John- Yeah. “bass-ackwards” was a but bad, but fun anyway. My blog, my language.
@Bogdan- Glad I could help.
@damokles- aptitude search ~dfractal. You need the ~d if you are going to be searching for text inside the description of the package, and not the package name itself.
@Aaron: Thank you, that’s the punishment for not reading the manual
Cool info, I just removed 1 GiB of obsolete packages with
What I wonder is when I use if I wanna get rid of the build dependencies & everything of foo how would I go about doing that. The manual of apt-get just says
build-dep
build-dep causes apt-get to install/remove packages in an attempt to satisfy the build dependencies for a source package.
Thanx for a great write-up.
I used apt-get quite some time and then read that “one should use aptitude”. But I never really liked it, because I kept on forgetting how to search for packages the right way (”aptitude search ~dkeyword” was not intuitive enough for me).
When I read about wajig, I tried it and it was a delight! So if you are just busy trying out aptitude and have some minutes left, just give it a chance too!
Currently I use yum, trying to learn how to use Red Hat… I like Fedora but its packagesystem has not convinced me yet as much as Debians system did.
I think the main feature present in aptitude and that I have not seen in apt-get is the hability to downgrade selected packages. It may take a while sometimes, but I can install an older package.
@Alex Chekholko & Lucato - You can keep Aptitude from automatically installing recommended packages by adding this to the /etc/apt/apt.conf file:
@ Aaron - Nice post. You will be either happy or sad or just amused to hear that this blog entry has led to a four page (and counting) Aptitude vs. apt-get thread on forums.debian.net
RPM hell no longer exists. It’s called YUM.
Nice article…
Though i disagree on one point…if you use aptitude to remove a package installed with apt-get, it will perfectly remove all dependencies.
When removing a package, aptitude checks if there will be some unused packages, not caring about the way there were installed…I’m pretty sure aptitude would remove an unused package, even if it had been installed manually, using a dpkg command.
Try it yourself if you need to be convinced of that…there’s no problem at all with mixing apt-get and aptitude.
I prefer use the opensuse distribution.
{ 23 } Trackbacks
[...] by default there are two ways to manage packages on the command line: apt-get and aptitude. The better of the two is aptitude. In fact, it looks like the only advantage apt-get has over aptitude is the easier name. The [...]
[...] http://www.pthree.org/2007/08/12/aptitude-vs-apt-get/ aptitude run with no options will pull up a curses application for you to navigate your apt system. (tags: apt-get debian ubuntu) [...]
[...] Read More [...]
[...] Toponce has written a nice post called Aptitude vs Apt-Get, in which he compares the features of the tools aptitude and apt-get available on Debian-based [...]
[...] * Aptitude vs Apt-Get (What Everyone Should Know) - This blog article by Aaron Toponce aka atoponce, is a very good read for everyone, newbie or seasoned veteran, about the differences between Aptitude and Apt-Get, and the tools associated with each. His conclusion: “Aptitude is just superior to apt-get in every way, shape, and form. Better dependency handling. Better curses application. Better options. ONE tool. Better standard formatting. The list goes on and on. I see constantly, on forums, IRC and email, the use of apt-get. We need to better educate our brethren and sisters about the proper use of tools, and show them the enlightened way of aptitude. I’ve been using aptitude since I first learned about it, ad will continue to do so the remainder of my Debian/Ubuntu days”. http://www.pthree.org/2007/08/12/aptitude-vs-apt-get/ [...]
[...] Toponce has written a comparison of Debian’s standard package management tools for end users, aptitude and apt-get. He prefers [...]
[...] can’t remove dependencies? 13Aug07 So reports Aaron [...]
[...] From pthree.org [...]
[...] – Aptitude vs Apt-Get Mount a Windows shared folder in [...]
[...] entre conflictos de versiones, actualizaciones de dependencias y eliminación de las mismas. En éste artículo se discuten las ventajas de usar un todo en uno como Aptitude, ahorrándonos procedimientos [...]
[...] Aaron Toponce » Aptitude vs Apt-Get. Very cool tool. Definitely worth looking into if you’re working on a Debian-based distro–it’s a heck of a lot easier to use than the apt-* tools, and, like he says, it’s one command. [...]
[...] problemas entre conflitos de versións, actualizacións de dependencias e eliminación das mesmas. Neste artigo discútense as vantaxes de usar un todo nun como Aptitude, aforrándonos procedementos accesorios e [...]
[...] Aptitude vs Apt-Get Interessanter Artikel zu beiden Möglichkeiten Pakete unter Debian zu managen. [...]
[...] tiver sorte conseguirá ter a aplicação original instalada. O sistema de pacotes do Debian é super versátil e o Ubuntu ainda criou front-ends facílimos de usar que fazem da instalação de software uma [...]
[...] tiver sorte conseguirá ter a aplicação original instalada. O sistema de pacotes do Debian é super versátil e o Ubuntu ainda criou front-ends facílimos de usar que fazem da instalação de software uma [...]
[...] Tłumaczenie na podstawie: Aptitude vs apt-get [...]
[...] libraries, and modules. While browsing several articles on Digg I came across this one: “Aptitude vs apt-get“. It looks like Aptitude should be the preferred tool given comments like, “Aptitude is [...]
[...] Aaron Toponce » Blog Archive » Aptitude vs Apt-Get (tags: linux tech software) [...]
[...] read more | digg story [...]
[...] Aptitude vs Apt-Get [...]
[...] bookmarks tagged slick Aptitude vs Apt-Get saved by 1 others jynxcat8 bookmarked on 12/31/07 | [...]
[...] online community. The best part is … it’s all 100% free! check them out here: Join Hey Nielsen! Aptitude vs Apt-Get saved by 1 others gillyrudolf bookmarked on 01/05/08 | [...]
[...] Toponce has a recent article with well laid out logic for aptitude which is based on this older explanation of aptitude. But there does seem to be a minor religious [...]
Post a Comment