Contents
Introduction
Aptitude is an Ncurses and command-line based front-end to numerous Apt libraries, which are also used by Apt, the default Debian package manager. Aptitude is text based and run from a terminal.
Aptitude has a number of useful features, including:
- a mutt-like syntax for matching packages in a flexible manner
mark packages as "automatically installed" or "manually installed" so that packages can be auto-removed when no longer required (feature available in Apt, too, since quite a few Debian release)
- preview of actions about to be taken with different colors marking different actions
- persistence of user actions (similar to dselect)
- the ability to interactively retrieve and display the Debian changelog of all available official packages
apt-like (i.e. apt-get and apt-cache) command line mode ("aptitude install foo")
Score-based dependency resolver which is more suitable for interactive dependency resolution with additional hints from the user like "I don't want that part of the solution but keep that other part of the solution for your next try". Apt's dependency resolver on the other hand is optimized for good "one shot" solutions.
The primary command is "aptitude", as is the name of its primary Debian package.
Aptitude User Manual
Online: The manual for the latest version of aptitude is usually available (in English) on the Debian website.
- On your local system:
If you have the package aptitude-doc-en installed (other languages are available), you can find an HTML manual for your installed version in /usr/share/doc/aptitude/html/en/index.html (change path for other languages as appropriate).
If you have just aptitude installed (e.g. for disk space reasons), a plain text variant of the user manual is still available at /usr/share/doc/aptitude/README.
Interactive Use
To run interactively, enter the following from a terminal emulator:
aptitude
After running it, use:
- F10 or Ctrl-T to access the menu.
- '?' for help
- The 'up', 'down', 'left', 'right' keys to navigate.
- The 'Enter' key to select or open and close a single level
- The bracket keys ('[' and ']') to open and close levels recursively
- The '+' or '-' key to install/update or remove a package
- The 'g' key to preview/confirm actions
- 'q' to quit – this also closes the currently open window (‘g’ goes forward, ‘q’ goes back)
- Forward and backward slash ('/' and '\') for searching forward or backward.
The common use of aptitude in TUI (text user interface) is; run aptitude; press 'u' (update the lists of available packages); press 'U' (Mark all upgradable packages to be upgraded); (search/select some stuff to install, is optional); press 'g' (to see the pending actions and modify if needed); press 'g' (again, to start the download).
Some time when you need to resolve conflicts, you discover that you made a mistake; you can easily use 'Cancel pending actions' in the 'Actions' menu so that you can re-select.
When reviewing dependency resolutions (shown after pressing 'e'), press:
- cursor keys or vi style j/k to select actions or action groups,
- 'a' to explicitly insist on an action (use again to go back to no specific decision)
- 'r' to reject an action (use again to go back to no specific decision)
- dot ('.') to show the next proposed dependency resolution
- comma (',') to show the previous proposed dependency resolution
- exclamation mark ('!') to accept the currently shown dependency resolution
When reviewing pending actions, press:
- 'g' again to go ahead and execute the pending actions
- 'q' to go back to the previous view
See Accessing package information for understanding the letters in the package synopsis line (e.g., 'i' means "will be installed", 'p' means "not installed", etc.)
Commandline Use
Functions only useful as root
You can also use aptitude in the same manner as apt-get:
Update the packages list :
# aptitude update
Upgrade the packages :
# aptitude safe-upgrade
Install foo :
# aptitude install foo
Remove bar :
# aptitude remove bar
Purge foo :
# aptitude purge foo
Functions useful for every user
Search for packaging containing foo :
$ aptitude search foo
Personally, I still use apt-cache search foo to perform a search – aptitude search foo is slower. But you should try the aptitude search foo way. You should discover that the output is a bit different from apt-cache, in some cases, it may be useful to search for a package to see if it is already installed.
showing if a specific package is installed :
$ aptitude show foo
How to upgrade your distribution
Upgrading from one stable release to the next (e.g. Lenny to Squeeze) is done by following the release notes for your architecture. For most people with 32 bit systems that means the Release Notes for Intel x86. For most with 64 bit systems that means the Release Notes for AMD64.
Using full-upgrade in the regular course of events is no longer the recommended practice (unless you are running sid, in which case you should not need to be reading this.)
Minor release upgrades (e.g. from lenny 5.0.1 to 5.0.2) and security updates are done with safe-upgrade.
- Find out the current version of Debian that you are running:
$ cat /etc/debian_version
Example for upgrading from, e.g., etch 4.0r1 to 4.0r2 ...etc., or applying security upgrades:
# aptitude update # aptitude safe-upgrade
apt vs aptitude
Action |
apt command |
aptitude command |
Install foo |
apt install foo |
aptitude install foo |
Search foo |
apt search foo |
aptitude search foo |
List installed packages |
apt list --installed |
aptitude search ~i |
Remove foo |
apt remove foo |
aptitude remove foo |
List reverse dependencies |
apt rdepends foo |
aptitude search ~Dfoo |
Print information on priorities for foo |
apt policy foo (since Buster), apt-cache policy foo |
aptitude versions foo |
Show package information for foo |
apt show foo |
aptitude show foo |
Download foo's sources |
apt source foo |
aptitude source foo |
Download foo's sources and build a binary .deb package |
apt source --compile foo |
(none) |
Advanced search patterns
Looking for packages installed from anything else than stable:
aptitude search '?narrow(?installed, !?archive(stable))'
Looking for packages installed from testing (assuming you have sources lists with stable and testing repositories):
aptitude search '?narrow(?installed, ?archive(testing) !?archive(stable))'
List packages of contrib and non-free components installed:
aptitude search '~i ?section(non-free)'
aptitude search '~i ?section(contrib)'
To list packages of non-free-firmware installed:
aptitude search '~i ?section(non-free-firmware)'
The Debian project has taken the decision in 2022-10 to create a new repository component non-free-firmware, and include its content on installation media for the upcoming Debian release bookworm to make things easier for our users.
But remember that:
The contrib packages contain DFSG-compliant software, but have dependencies not in main (possibly packaged for Debian in non-free).
The non-free contains software that does not comply with the DFSG.
See the aptitude search term reference
Historic Aptitude GUI
Historically there were also a GTK and a never-finished Qt GUI.
Aptitude's GTK GUI was always considered experimental and formerly packaged as "aptitude-gtk". This is also the reason for the use of "update-alternatives" for aptitude. The last Aptitude release which shipped a GTK interface was Aptitude 0.6.5 (and the according Debian package aptitude 0.6.5-1).
The never-finished Qt interface was never included in any official Debian binary package.
While the Git history still contains the GTK and Qt code, the current branches HEADs no more have this code. Bringing them (or any of them) back would mean to re-add the code removed in the according commits and to update it to aptitude's current code on the one hand and the current GTK and Qt code bases on the other hand.
See Also
Aptitude in the Debian Package Management Book (German only)
Use Aptitude to restore an installed package permissions to their default
and ... apt.conf, preferences, sources.list, Aptitude::Parse-Description-Bullets=true, AptitudeTodo