What Is aptitude And How To Use It?

I already briefly discussed aptitude which is a debian package manager. In this article, we will see it in more detail, and also we will discuss how can we use it in different modes, i.e. interactive and command-line mode.

Aptitude is a high-level interface to the package manager that is used in Debian based Linux distributions. It provides a text-based menu that displays a list of packages and allows a user to perform package management tasks such as installation, removal, and up-gradation of packages. Actions are performed from a visual terminal-based menu by using a single key command.

Some useful features of aptitude

  • Apart from the terminal-based menu, it can be also used in command-line mode. For example, to install a package you can use –
    $ sudo aptitude install package_name
  • You can preview an action that is about to be taken different color marking is used for different actions
  • It has the ability to interactively retrieve and display the changelog of all available official packages
  • You can mark a package as automatically or manually installed so that packages can be auto removed if no longer required
  • It has score based dependency resolver which is more suitable for interactive dependency resolution

What is Aptitude interactive mode?

In this mode, a list of upgradable, installed, or not installed packages is displayed as the menu in the terminal. To use aptitude in interactive mode, use the following command in your terminal –

$ aptitude

Now the terminal menu will look something like this –

After running it you can use the following keys –

  • Ctrl+t to access the menu
  • Use ? for help
  • q to quit or close the current opening window
  • Up, down, right and left keys to navigate
  • Use key to preview, install or remove a package
  • The Enter key used to select or open or close a single level in the current window
  • Use / and \ for forward and backward searching of a package
  • To open and close level recursively [ or ] keys are used

If you do not run aptitude command with superuser privileges then before performing an action like installation or removal of a package it may prompt you to switch to the root user. You should confirm it if you want to perform such actions.

What is Aptitude command-line mode?

You can use aptitude also in command-line mode just like we use apt or apt-get. The following are some aptitude commands that you can use. You should either use these commands with superuser privileges or switch to root user and then execute them-

To install a package –

aptitude install package-name

To uninstall or remove a package –

aptitude remove package-name

Use the following command to remove a package along with its dependensies-

aptitude purge package-name

To update the package list or apt’s database-

aptitude update

To upgrade the packages safely use the following command –

aptitude safe-upgrade

Use the following command to search a package in Linux. It will list all the packages that match with the pattern –

aptitude search package-name

To display the details of an installed package in your system use the following command-

aptitude show package-name

Look at the screenshot below it shows the use of aptitude in command-line mode-

aptitude vs apt-get

Aptitude and apt-get both are high-level interfaces to package manager in Debian and its derivatives. The most obvious difference between these two is that aptitude provides a terminal menu interface while apt-get does not. If you only consider the command-line interface of each then both are quite similar to each other. Some minor difference are given below-

  • Few commands are different like upgrade and dist-upgrade are renamed in the aptitude to probably more accurate names that are safe-upgrade and full-upgrade respectively
  • aptitude performs functions of not only apt-get but some other similar tools like apt-cache, apt-mark, etc
  • aptitude has slightly different query syntax for searching for a package from apt-cache. The aptitude search result may contain a little bit more information.
  • aptitude can suggest several potential resolutions while performing an action like installation, removal or up-gradation of a package But this feature is not available in apt-get


Leave a Comment