Linux Package Management with Aptitude

Aptitude is a text-based front-end for APT (Advanced Package Tool) built on the Ncurses library, designed for Debian-based systems. It provides an interactive interface for package management and runs from the terminal or command line interface. This article explains Linux Package Management with Aptitude and APT commands.

What is APT

APT is a command-line package manager that provides commands for searching, managing, and querying information about packages. It offers the same functionality as specialized APT tools like apt-get and apt-cache, but with options more suitable for interactive use by default.

To get more information about APT, use the following command:

$ apt

The sample output should be like this:

apt 1.2.15 (amd64)
Usage: apt [options] command
apt is a commandline package manager and provides commands for
searching and managing as well as querying information about packages.
It provides the same functionality as the specialized APT tools,
like apt-get and apt-cache, but enables options which are more suitable for
interactive use by default.
Most used commands:
  list - list packages based on package names
  search - search in package descriptions
  show - show package details
  install - install packages
  remove - remove packages
  autoremove - Remove automatically all unused packages
  update - update list of available packages
  upgrade - upgrade the system by installing/upgrading packages
  full-upgrade - upgrade the system by removing/installing/upgrading packages
  edit-sources - edit the source information file
See apt(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
This APT has Super Cow Powers.

Common APT Operations

List of Packages

To get a list of packages based on package name, use the following command:

$ apt list

The sample output shows available packages:

revolution-r/xenial,xenial 3.0.0-1ubuntu1 all
revu-tools/xenial,xenial,trusty,trusty 0.6.1.5 all
rex/xenial,xenial 1.3.3-1 all
rexical/xenial,xenial 1.0.5-2build1 all
rexima/xenial 1.4-7build1 amd64
rfc5766-turn-server/trusty 3.2.3.1-1 amd64
rfcdiff/xenial,xenial 1.42-1 all
rfdump/xenial 1.6-4 amd64
rfkill/xenial,now 0.5-1ubuntu3 amd64 [installed,automatic]
rgbpaint/xenial,trusty 0.8.7-5 amd64
rgxg/xenial,trusty 0.1-1 amd64
rhash/xenial 1.3.3-1 amd64
rhc/xenial,xenial 1.38.4-2 all
rheolef/xenial 6.6-1build2 amd64
rheolef-doc/xenial,xenial 6.6-1build2 all
rhino/xenial,xenial 1.7R4-3 all
rhino-doc/xenial,xenial 1.7R4-3 all
rhinote/xenial,xenial,trusty,trusty 0.7.4-2 all
rhn-client-tools/xenial 1.8.26-4 amd64
rhnsd/xenial 5.0.4-3 amd64
..................................................................

Installing a Package

To install a package with APT, use the following command:

$ sudo apt install firefox

The above command installs Firefox. The sample output should be like this:

Reading package lists... Done
Building dependency tree
Reading state information... Done
firefox is already the newest version (50.1.0+build2-0ubuntu0.16.04.1).
firefox set to manually installed.
The following packages were automatically installed and are no longer required:
  libterm-readkey-perl linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
  linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
  linux-signed-image-4.4.0-31-generic
Use 'sudo apt autoremove' to remove them.
..................................................................

Removing a Package

To remove a package using APT, use the following command:

$ sudo apt remove firefox

The above command removes the Firefox package from Linux. The sample output should be like this:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libterm-readkey-perl linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
linux-signed-image-4.4.0-31-generic
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
firefox
0 upgraded, 0 newly installed, 1 to remove and 26 not upgraded.
After this operation, 114 MB disk space will be freed.

Removing Unused Packages

To automatically remove all unused packages, use the following command:

$ sudo apt autoremove

The sample output should be like this:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libterm-readkey-perl linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
linux-signed-image-4.4.0-31-generic
0 upgraded, 0 newly installed, 6 to remove and 26 not upgraded.
After this operation, 295 MB disk space will be freed.
..............................................................................

Updating Package Lists

To update the package lists from repositories, use the following command:

$ sudo apt update

Upgrading Installed Packages

To upgrade the system by installing/upgrading packages, use the following command:

$ sudo apt upgrade

APT vs Aptitude Comparison

Feature APT Aptitude
Interface Command-line only Text-based interactive UI + CLI
Dependency Resolution Basic Advanced with conflict resolution
Package Removal Manual cleanup needed Automatic cleanup of unused packages
Learning Curve Simple Moderate (more features)

Conclusion

APT provides essential command-line package management functionality for Debian-based systems, while Aptitude offers enhanced features like better dependency resolution and an interactive interface. Both tools are fundamental for maintaining Linux systems and managing software packages efficiently.

Updated on: 2026-03-17T09:01:38+05:30

424 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements