Using aptitude Command In Linux: An Important Tool

aptitude package tool or aptitude command in Linux distros is used for accessing a highly built-in interface to interact with package manager. Basically, the tool is considered as a control panel of programs installed on a Windows platform. With the help of this tool, users can install, upgrade and remove any packages through an interactive interface. The same actions can also be accomplished through command line using apt-get command in Linux, which we have already covered in previous article.

Syntax to use aptitude

aptitude [options] <action>

Installation Guide of aptitude in Linux

In order to use the aptitude in Linux platform, we first need to install it on system. To do so, run the command below:

For root privileged users

apt install aptitude

For non-root privileged users

sudo apt install aptitude

How to use aptitude package tool?

Once the installation is done, users can run the following command to open interactive interface before users on screen on terminal:


Most important uses of aptitude tool in Linux

Viewing package descriptions: The first important use of aptitude command is to install, upgrade and remove packages by selecting available options in the menu panel

aptitude command in Linux

aptitude package tool

Viewing packages and sup-packages: With the help of aptitude, one can also view various sub packages under installed packages. One can notice ‘-’ before the name of packages, that indicates the the package has sub-packages as well.

aptitude command line tool

Running command line argument as root: In case if any command line argument is passed, it can be processed only if root access is provided to aptitude. To do so, users can click on Become root option under Actions menu. It will ask for root credentials, and can start working.

How to use aptitude command

Command line actions to do with aptitude

In case if no argument is supplied to aptitude command, it will enter into interactive mode, and a number of command line actions can be performed, which includes:

  • install: This action helps to install or upgrade a package
aptitude install specify_package_name
  • remove: Obviously, it will remove a selected package
aptitude remove specify_package_name
  • purge: It’s used for removing all configuration files of removed packages
aptitude purge specify_package_name
  • hold: Used for placing a package on hold by terminating any active installation, upgrade or removal actions.
aptitude hold package name
  • unhold: This action is used for unhold the package which was hold in above scenario.
aptitude unhold specify_package_name
  • markauto | unmarkauto: used for marking and de-marking packages as having been installed automatically
aptitude markauto specify_package_name
aptitude unmarkauto specify_package_name
  • full-upgrade: Used for performing a full upgrade, means removing the packages first, then reinstalling it
aptitude full-upgrade
  • forbid-version: Used for forbidding the aptitude command from upgrading a certain package to specified version
  • update: Used for downloading the list of upgradeable packages
  • safe-upgrade: Obviously, it’s used for performing a safe upgrade of package
  • forget-new: Used for telling aptitude to forget the packages are new
  • search: Used for searching a package by its name or related expression
  • build-dep: This can be used to install any build-dependencies of a certain package
  • show: Used for displaying information of a specified package
  • showsrc: Used for displaying information about source package
  • versions: It will display version of packages
  • clean: It will delete all downloaded package files
  • autoclean: Used for deleting all older downloaded package files
  • changelog: Used for viewing changelog of a package
  • download: Downloads .deb file for a package
  • source: Downloads the source package
  • reinstall: Re-installs a specified package
  • why: Shows the explanation why a package should be installed
  • why-not: Obviously, it will display why a package cannot be installed
  • add-user-tag: Adds user tag to packages
  • remove-user-tag: Used for removing tag from packages which are tagged with previous command

Available options to use with aptitude command in Linux

-D | -show-deps: This option is used for commands that are used to install or remove packages
-d | -download-only: Used for downloading packages to package cache only.
-f: It’s primarily used to fix the dependencies of broken packages
-h | -help: Displays help information and exits