aptitude Command Examples in Linux

On a Linux system, the aptitude command is a package manager that is used to install, remove, and manage software packages. It is similar to the apt-get command, but it has a more user-friendly interface and additional features.

To use aptitude, you will need to have root privileges or use the sudo command to run it with superuser permissions. For more information and a complete list of aptitude commands, you can refer to the aptitude man page by running man aptitude in the terminal.

aptitude Command Examples

1. Synchronize list of packages and versions available. This should be run first, before running subsequent aptitude commands:

# aptitude update

2. Install a new package and its dependencies:

# aptitude install {{package}}

3. Search for a package:

# aptitude search {{package}}

4. Search for an installed package (?installed is an aptitude search term):

# aptitude search '?installed({{package}})'

5. Remove a package and all packages depending on it:

# aptitude remove {{package}}

6. Upgrade installed packages to the newest available versions:

# aptitude upgrade

7. Upgrade installed packages (like aptitude upgrade) including removing obsolete packages and installing additional packages to meet new package dependencies:

# aptitude full-upgrade

8. Put an installed package on hold to prevent it from being automatically upgraded:

# aptitude hold '?installed({{package}})'
Related Post