Basic Package Management Operations Using Aptitude

debianaptitude is a featureful package manager for Debian GNU/Linux systems, based on the renowned apt package management infrastructure. aptitude provides the functionality of dselect and apt-get, as well as many additional features not found in either program.

For the package management operation which involves package installation or updates package metadata, you need to have root privilege.

Here are basic package management operations with commandline using aptitude(8).

Working With aptitude

Update package archive metadata.

aptitude update

Install candidate version of “foo” package with its dependencies.

aptitude install foo

Install candidate version of installed packages without removing any other packages.

aptitude upgrade

Install candidate version of installed packages while removing other packages if needed.

aptitude dist-upgrade

The difference between “safe-upgrade”/”upgrade” and “full-upgrade”/”dist-upgrade” only appears when new versions of packages stand in different dependency relationships from old versions of those packages. The “aptitude safe-upgrade” command does not install new packages nor remove installed packages.

Remove “foo” package while leaving its configuration files.

aptitude remove foo

Remove “foo” package and its configuration files.

aptitude purge foo

Clear out the local repository of retrieved package files completely.

aptitude clean

Clear out the local repository of retrieved package files for outdated packages.

aptitude autoclean

Display detailed information about “foo” package.

aptitude show foo

Search packages which match ‘regex’.

aptitude search <regex>

Explain the reason why ‘regex’ matching packages should be installed.

aptitude why <regex>

Explain the reason why ‘regex’ matching packages can not be installed.

aptitude why-not <regex>

Notable command options for aptitude

-s simulate the result of the command
-d download only but no install/upgrade
-D show brief explanations before the automatic installations and removals

List of the aptitude regex formula

~n match on package name
~d match on description
~t match on task name
~G match on debtag
~m match on maintainer
~s match on package section
~V match on package version
~A{sarge,etch,sid} match archive
~O{debian,…} match origin
~p{extra,important,optional,required,standard} match priority
~E match essential packages
~v match virtual packages
~N match new packages
~a{install,upgrade,downgrade,remove,purge,hold,keep} match with pending action
~i match installed packages
~M match installed packages with A-mark (auto installed package)
~i!~M match installed packages without A-mark (administrator selected package)
~U match installed and upgradable packages
~c match removed but not purged packages
~g match removed, purged or can-be-removed packages
~b match packages with broken relation
~B match packages with broken depends/predepends/conflict
~D[:] match packages from which relation is defined to package
~DB[:] match packages from which broken relation is defined to package
~R[:] match packages to which the package defines relation
~RB[:] match packages to which the package defines broken relation
~R~i match packages to which some other installed packages depend on
!~R~i match packages to which no other installed packages depend on
~R~i|~Rrecommends:~i match packages to which some other installed packages depend or recommend on
~S filter match package with filtered version
~T match all packages (true)
~F match no packages (false)

2 Comments

lachlan December 15, 2010

why is something i haven’t used before. that will help.

i have never used “aptitude –purge remove” before, just “aptitude purge” is there any point to the extra words?

vinod December 15, 2010

NO. apt-get man page says remove –purge is equivalent for purge command. Thanks for pointing that out.