Basic Package Management Operations Using Aptitude
aptitude 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 updateInstall candidate version of “foo” package with its dependencies.
aptitude install foo
Install candidate version of installed packages without removing any other packages.
aptitude upgradeInstall candidate version of installed packages while removing other packages if needed.
aptitude dist-upgradeThe 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 fooRemove “foo” package and its configuration files.
aptitude purge fooClear out the local repository of retrieved package files completely.
aptitude cleanClear out the local repository of retrieved package files for outdated packages.
aptitude autocleanDisplay detailed information about “foo” package.
aptitude show fooSearch 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
~d
~t
~G
~m
~s
~V
~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
~D[
~DB[
~R[
~RB[
~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
~T match all packages (true)
~F match no packages (false)




Many times I prefer to just work from the shell. The ~/.bashrc file is a great place to put functions if you are using them regularly.
Recent Comments