How to use Aptitude package tool on Debian, Ubuntu and Mint linux

Photo of author

By rasho

Aptitude is a front-end to the Advanced Packaging Tool (APT). It displays a list of software packages and allows the user to interactively pick packages to install or remove. It has an especially powerful search system utilizing flexible search patterns. It was initially created for Debian, but has appeared in RPM Package Manager (RPM) based distributions as well (such as Conectiva).
Aptitude is based on the ncurses computer terminal library, with which it provides an interface that incorporates some elements commonly seen in graphical user interfaces (GUIs) .
In addition to the ncurses interface, aptitude provides an extensive command-line interface (CLI). Even though aptitude is one executable file, it provides command-line functions similar to those of apt- family of tools (apt-get, apt-cache, apt-listchanges, etc.). Aptitude also emulates most apt-get command-line arguments, allowing it to act as a full replacement for apt-get. In the past, it was recommended that aptitude and apt-get not be used interchangeably.
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
  • colorful preview of actions about to be taken
  • dselect-like persistence of user actions
  • the ability to retrieve and display the Debian changelog of most packages
  • AptCLI-like (= apt-get + apt-cache) command line mode (“aptitude install foo”)
  • Score-based and (usually) smarter dependency resolver than apt-get

Aptitude basic usage

Before we move to the tutorial part, make sure that aptitude is installed in your system. If it isn’t you can run following command to install aptitude in your system:

# sudo apt-get install aptitude

Aptitude can be used both in CLI mode or in GUI mode. In both the modes, you need to have root privileges to run aptitude.

Run aptitude in GUI mode

To launch aptitude in GUI mode enter following command in terminal without any parameters:

# sudo aptitude
Aptitude GUI mode
Aptitude GUI mode

To have an access to the menus, you will have to press Ctrl+T and in order to navigate through the menu, use arrow keys.

Aptitude menu
Aptitude menu

Installing packages

To install packages, you can browse the packages first. After you found the package, select it then press “+ button. Press g button to preview the summary of package actions. To commit the installation press g button again.

Aptitude GUI mode installation package
Aptitude GUI mode installation package

 

Aptitude select package to installation
Aptitude select package to installation

You may see the state of the packages on the left the name of packages. Here’s a list of the packages state :

  • i : Installed package
  • c: Package not installed, but the configuration remains on the system
  • p : Purged from system
  • v : Virtual package
  • B : Broken package
  • u : Unpacked files, but files not yet configured
  • C : Half-configured – Configuration failed and require fix
  • H : Half-installed – Removal failed and require fix

Removing package

To remove a package simply select a package then press “–  button”. Press g button to view a summary of the activity. Press g button again to commit remove the package.
[ads]

Aptitude GUI mode remove package
Aptitude GUI mode remove package

Updating packages

To update the package index, simply press “u botton”.

Aptitude GUI mode update package
Aptitude GUI mode update package

Upgrading packages

To upgrade packages, press “u button”. It will mark all upgradable packages. Then press “g button” to view the summary of packages actions. Press “g button” again to commit the upgrade process.

Aptitude GUI mode upgrade packages
Aptitude GUI mode upgrade packages

Aptitude from the command line

aptitude update

# sudo aptitude update

aptitude install package

# sudo aptitude install gimp

aptitude remove package

# sudo aptitude remove gimp

aptitude safe-upgrade

The safest way to upgrade is to use the action “safe-upgrade” as the previously used action “upgrade” has been deprecated. The new action will upgrade a package only if it does not impact other packages, i-e: if it is necessary to add or remove a dependency package during upgrade, safe-upgrade won’t upgrade.

# sudo aptitude safe-upgrade

If you want to force the upgrade anyway, the action “full-upgrade” can be used. With this command, aptitude will upgrade to the latest version of a package even if it is necessary to add or remove dependencies.

# sudo aptitude full-upgrade

For more information aboud aptitude see aptitude man page
See also: How to use YUM (Yellowdog Updater, Modified) command on RHEL/CentOS, Fedora Linux

Leave a Comment