aptitude
makes it convenient to show what programs in a search you already have installed on the system (with the help of grep
):
aptitude search flash | grep ^i
Actually, aptitude
's search is far more powerful than what you get piping through grep
, as it supports contextual searching:
e.g., this finds all packages with 'flash' in the package name that are installed:
aptitude search '~iflash'
An equivalent "long form" of the "short form" ~i
:
aptitude search '?installed(flash)'
Note that search patterns are free (unanchored) by default. To anchor them, you need to use anchor patterns '^
' (beginning of string) and/or '$
' (end-of-string).
To find all packages whose names start with either 'ttf' or 'font':
aptitude search '(^ttf|^font)'
(Note: this is a workaround for a bug in aptitude
, as the correct regex of '^(ttf|font)'
does not work properly -- it finds packages whose names start with 'ttf' or contain 'font'.)
Other nifty aptitude
features:
Show all packages with 'firmware' in their name that ALSO have 'wireless' in their description:
aptitude search 'firmware ~dwireless'
or long form:
aptitude search '?and(?name(firmware),?description(wireless))'
(Note: in the short form, space-delimited arguments are ANDed within quotes; if passed as separate argv[] commandline arguments they are ORed.)
p atmel-firmware - Firmware for Atmel at76c50x wireless networking chips.
p firmware-atheros - Binary firmware for Atheros wireless cards
...
p libertas-firmware - Firmware for Marvell's libertas wireless chip series
p zd1211-firmware - Firmware images for the zd1211rw wireless driver
~U
shows all packages that are Upgradeable from their current versions with new versions:
# aptitude update ; aptitude versions '~U'
Package virtualbox-4.1:
i 4.1.18-78361~Debian~squeeze 100
p 4.1.20-80170~Debian~squeeze <NULL> 500
Show packages that Recommend 'gcc-multilib'
$ aptitude search '~DRecommends:gcc-multilib'
i libc6-dev-i386 - Embedded GNU C Library: 32-bit development libraries for AMD64
Explain why 'fuse-utils' might need to be installed
$ aptitude why fuse-utils
i xorg Depends xterm | x-terminal-emulator
pi gnome-terminal Provides x-terminal-emulator
pi gnome-terminal Recommends gvfs
pi gvfs Depends libgdu0 (>= 2.29.90)
pi libgdu0 Depends udisks (< 1.1.0)
pi udisks Recommends ntfsprogs
pi ntfsprogs Depends fuse-utils (> 2.5.0)
(This example shows some of the craziness resulting from the default since Squeeze(?) of installing all "Recommends" packages. Installing gnome-terminal ends up installing ntfsprogs and fuse-utils, egad! I think most folks just want the terminal perspective and not the builtin NTFS integration, which is optional, unless they specified it.)
Find all packages that provide the service "mail-transport-agent":
$ aptitude search '?provides(mail-transport-agent)'
p citadel-mta - complete and feature-rich groupware server (mail transport agent)
...
p nullmailer - simple relay-only mail transport agent
p postfix - High-performance mail transport agent
i sendmail-bin - powerful, efficient, and scalable Mail Transport Agent
p ssmtp - extremely simple MTA to get mail off the system to a mail hub
p xmail - advanced, fast and reliable ESMTP/POP3 mail server
Show all package names that are installed, that are not either Essential or Automatically installed by dependencies:
$ aptitude search '~i!(~E|~M)' -F '%p'
Unfortunately, this stuff is rather poorly documented and hard to find, but here's the best reference (from the 'aptitude' maintainer).
aptitude
by default.apt-get source package-name
will do it, but I've seen no aptitude equivalentaptitude search package-name
works in aptitude. Another isaptitude why package-name
is also useful but not inapt-get
. I also thing that the command line ofaptitude
is a bit cleaned up compared toapt-get
. But as you noticed, there areaptitude build-dep package-name
but noaptitude source package-name
.