aptitude is now the preferred text front end for apt. aptitude is like synthetic motor oil; once you start using it, it is best to continue using it rather than alternative methods of installing packages; otherwise you lose the advantage of aptitude keeping track of which packages you have deliberately installed.
Local documentation can be found by browsing to file:///usr/share/doc/aptitude/README
Or install the Aptitude user's manual package
aptitude install aptitude-doc-en
and then browse to file:///usr/share/doc/aptitude/html/en/index.html
Many of the examples below use shorthand search terms. Here is a quick guide to search terms
Remove all packages with joe in the name
aptitude remove ~njoe
List all packages
aptitude search ~n
List all packages that are not installed
aptitude search "?not(?installed)"
List all packages that are installed
aptitude search "(?installed)"
List all automatically installed packages:
aptitude search ~M
List all virtual packages
aptitude search ~v
List all orphaned packages
deborphan
Remove all orphaned packages
deborphan | xargs aptitude -y purge
The aptitude data is in /var/lib/aptitude/pkgstates and can be consulted to determine:
Count the total number of packages available:
cat /var/lib/aptitude/pkgstates|grep Package:|wc -l
.deb files are located in /var/cache/apt/archives/
They are actually BSD ar archives
$ cp /var/cache/apt/archives/joe_3.5-2_i386.deb . $ ar x joe_3.5-2_i386.deb $ cat debian-binary 2.0 $ tar -xzOf control.tar.gz $ tar tzf data.tar.gz
Or use less:
$ export LESSOPEN="|lesspipe $s" $ less joe_3.5-2_i386.deb
Or use MC. The control files will be in ./DEBIAN and the contents under .CONTENTS
synaptic is now the preferred Gtk GUI front end for APT
You know a package name and want information about it:
aptitude show joe
You have .deb file and you want information about it:
dpkg-deb info xxx.deb dpkg-deb --field fieldname xxx.deb
You have a file, say /usr/bin/htdbm, and you want to know which package it came from. Solution:
$ dpkg --search /usr/bin/htdbm apache2-utils: /usr/bin/htdbm $
You need a file, say /usr/bin/convert, and you want to know which package to get. Solution:
$ apt-file search /usr/bin/convert ... imagemagick: /usr/bin/convert ... $
You need to identify configuration files that need manual migration after a package upgrade:
$ find /etc -name '*.dpkg-*'
You want a list of all files provided by a package:
apt-file list pkg.name dpkg --search pkg.name
You want to know the version of an installed package:
$ apt-show-versions joe joe/lenny uptodate 3.5-2 $
You can also use dpkg:
dpkg --list joe
You want to list all installed packages:
apt-show-versions
You want to list all the packages that are not installed:
apt-show-versions -R
![]() |
This site best viewed with a browser |
| Warning: This is a Debian centric site | |
| Many thanks to Debra and Ian Murdock for making Debian possible | |
| First created Apr 22, 2008 ~ Last revised October 14, 2009 |