198

When I first started with Ubuntu using aptitude was the 'in-thing', with some stated improvements over apt-get. Am I correct in saying that apt-get has now 'caught up' with aptitude, and it makes little difference which is used (although it is preferable to choose one or the other, and stick with it)?

Moreover, with aptitude set to be removed from a default Ubuntu install, should everyone revert to apt-get, especially when guiding new users interested in the CLI?

8128
  • 28,630
  • 27
  • 111
  • 145
  • 1
    the cool kids today use `apt` instead of either of those : https://itsfoss.com/apt-vs-apt-get-difference/ – tatsu Jul 16 '19 at 08:15
  • 1
    `aptitude why` is handy sometimes, and [there isn't a real equivalent](https://askubuntu.com/questions/424150/what-is-apt-get-equivalent-of-aptitude-why). – Nathaniel M. Beaver Jul 17 '19 at 16:15

6 Answers6

133

As far as I can see, in 10.04, the main differences between aptitude and apt-get are:

  1. aptitude adds explicit per-package flags, indicating whether a package was automatically installed to satisfy a dependency: you can manipulate those flags (aptitude markauto or aptitude unmarkauto) to change the way aptitude treats the package.

    apt-get keeps track of the same information, but will not show it explicitly. apt-mark can be used for manipulating the flags.

  2. aptitude will offer to remove unused packages each time you remove an installed package, whereas apt-get will only do that if explicitly asked to with apt-get autoremove or specify --auto-remove.

  3. aptitude acts as a single command-line front-end to most of the functionalities in both apt-get and apt-cache. Note: As of 16.04, there is an apt command that includes the most commonly used commands from apt-get and apt-cache and a few extra features.

  4. In contrast to apt-cache's "search", aptitude's "search" output also shows the installed/removed/purged status of a package (plus aptitude's own status flags). Also, the "install" output marks which packages are being installed to satisfy a dependency, and which are being removed because unused.

  5. aptitude has a (text-only) interactive UI.

I personally use only aptitude for my command-line package management (and I never use the text UI); I find its output more readable than apt-get/apt-cache.

However, if aptitude will be no longer standard on Ubuntu, there's no other choice than use apt-get in instructions and how-to documents.

(Personally, I'm rather disappointed to see it go away in 10.10; especially since the improvements of aptitude over apt-get are mostly on the usability side. I guess they deemed that those conversant with the command-line know how to get aptitude back, and those who don't use the command-line will not care...)

alexia
  • 225
  • 1
  • 10
Riccardo Murri
  • 16,327
  • 8
  • 53
  • 51
  • 11
    aptitude search'es on package names, apt-cache on package name+description (We will just have to start every howto with `sudo apt-get install aptitude`) – LassePoulsen Aug 09 '10 at 08:46
  • 3
    2. However apt-get will tell you that there are unused packages and that you can remove them with `apt-get autoremove`. – sepp2k Aug 09 '10 at 09:19
  • 2
    One of the disadvantages of aptitude is the inability to consider pinning as done by apt-get – txwikinger Oct 15 '10 at 14:21
  • 4
    Aptitude correctly reads `/etc/apt/preferences` (and the pinning therein), but [currently](http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=557580) ignores `/etc/apt/preferences.d/`. It's a [known bug](http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=557580) so there is hope for it to be fixed soon. – Riccardo Murri Oct 15 '10 at 14:45
  • 1
    Would you mind if I removed all the backticks? All that (visual) noise makes this unreadable, even though it's a good answer. –  Oct 16 '10 at 19:16
  • @Roger: thanks for the suggestion, I kept only thos that were grouping two or more words. Feel free to edit more. – Riccardo Murri Oct 16 '10 at 19:43
  • 3
    Aptitude has an option to retrieve the changelog easily: `aptitude changelog package-name`. I am not aware of such feature in `apt-get`. – Lekensteyn Feb 13 '11 at 08:48
  • @RiccardoMurri for quick ref, it was marked Fixed in version 0.6.3-3.2 @ 18 Oct 2010 – underscore_d Oct 17 '15 at 17:56
  • 1
    What it an equivalent of `apt-get autoremove` with `aptitude`? I have old kernels that `apt-get autoremove` suggests me to remove, but i see no way to remove them with `aptitude`. – Alexey Feb 15 '17 at 23:52
  • @sepp2k It seems the behaviour of apt-get is different from the behaviour of aptitude in this regard, see the remark by Alexey above and the question http://askubuntu.com/questions/889771/how-to-make-aptitude-clean-up-old-kernels. – Jonas Dahlbæk Mar 09 '17 at 09:44
21

I guess it's a matter of personal choice by now. I find typing aptitude search makes more sense to me than apt-cache search, and I like that it tells me which packages I have installed right there in the search output, instead of having to run dpkg -l.

itsadok
  • 2,894
  • 4
  • 28
  • 28
  • 2
    +1 Agreed being able to see if an application is installed while searching is very handy. Although I do find that apt-cache search is a lot faster than aptitude search. – Mark Davidson Aug 09 '10 at 08:02
  • I use a two-letter bash alias for apt-cache search, or I would probably be using `aptitude search` as well. – belacqua Mar 08 '11 at 00:28
  • I've noticed that `apt-get`'s search is a bit more thorough than `aptitude`. The latter seems to only look at the package name, while the former also searches descriptions, I think. e.g. try searching for `build-essential`. – Sparhawk Sep 23 '13 at 02:45
13

Earlier apt-get would not manage dependencies properly and therefore cause orphaned dependencies to remain in a system even after the package that was using them was uninstalled - this is not longer the case, to remove orphaned dependencies use

sudo apt-get autoremove

aptitude always did this right and tracks dependencies better, but now both package managers do the job.

On ubuntu it is better to use apt-get because its supported and endorsed by the company, on debian I would use aptitude

keios
  • 111
  • 3
  • 2
    The last statement is not accurate. `aptitude` is supported just fine on Ubuntu and it is installed by default. There's no difference between Ubuntu and Debian in that regard, either. – loevborg Aug 09 '10 at 08:19
  • 3
    It is being removed from the default install in 10.10 – keios Aug 09 '10 at 09:57
  • 1
    In my experience, `aptitude` has always been worse at tracking installed dependencies. It tended to remove unrelated ones when removing a program, and ended up breaking other programs in the process... – Izkata Aug 13 '12 at 20:24
  • What it an equivalent of `apt-get autoremove` with `aptitude`? I have old kernels that `apt-get autoremove` suggests me to remove, but i see no way to remove them with `aptitude`. – Alexey Feb 15 '17 at 23:45
  • 1
    @Alexey You can use `aptitude remove '~g'`. ([Source](https://aptitude.alioth.debian.org/doc/en/ch02s04s05.html#searchGarbage)) Note that `aptitude` will automatically offer to remove unused dependencies when removing packages with it. – alexia Jul 16 '17 at 17:51
  • @nyuszika7h, `aptitude search '~g'` found only `linux-signed-image`, and i could remove it by running `aptitude install`. After that `aptitude search '~g'` does not find anything else, but `apt autoremove` proposes to remove `linux-headers`, `linux-image`, `linux-image-extra`... – Alexey Jul 17 '17 at 15:10
6

In addition to the other answers, it's also worth noting that apt-get often falls on its face for simple operations, and it has no ability to handle dependency version mismatches or broken packages (although it claims that broken packages can be fixed with apt-get install -f, I've literally never seen that work in my entire life).

For some reason, I still use apt-get by default, but when it encounters problems, I usually end up resolving them with aptitude, which never seems to encounter apt-get's numerous problems.

weberc2
  • 1,402
  • 2
  • 13
  • 24
  • I also have similar experience with resolving conflicts, `aptitude` is a way better alternative in that sense. – Volkan Yazıcı Apr 26 '17 at 19:13
  • 1
    For the record, I just saw apt-get install -f fix my system. aptitude had problems, this fixed it, and then first thing I did was apt install aptitude :) Choice is a good thing(tm) – teknopaul May 06 '18 at 12:58
3

I would say that in my personal experience aptitude and apt-get have very similar functionality.

The main difference that come to mind that might effect a users choices are, that aptitude offers an ncurses interface and that it offers options for safe-upgrade and full-upgrade that can come in handy.

Personally I always use apt-get and recommend that new users use apt-get as well. With aptitude set to be removed from Ubuntu by default as you said, this still seems to be the best recommendation. As if they did want to use aptitude they will need to know how to use apt-get to install aptitude if they want it :)

Mark Davidson
  • 1,221
  • 1
  • 15
  • 20
2

On a server I prefer Atitude because it comes with a pretty good interface to check package changelogs, selective upgrades and that kinds of stuff. apt-get is more quick though and I always use that if I just want to update everything without too much hassle.

Gladen
  • 2,726
  • 3
  • 20
  • 42