Graeme's Wiki

apt package manager tips
Last updated: 2011-10-20
Here are some command to query the APT (Debian / Ubuntu) package manager database.

What package does a file belong to?

$ dpkg -S /usr/bin/ls

Discovering a package names

For example, suppose that you want to reminisce about the good old days of the Atari 2600. You want to use APT to install an Atari emulator, and then download some games. You can do:
$ apt-cache search atari
atari-fdisk-cross - Partition editor for Atari (running on non-Atari)
circuslinux - The clowns are trying to pop balloons to score points!
madbomber - A Kaboom! clone
tcs - Character set translator.
atari800 - Atari emulator for svgalib/X/curses
stella - Atari 2600 Emulator for X windows
xmess-x - X binaries for Multi-Emulator Super System

We find several packages related to what we're looking for, together with brief descriptions. To get more information about a specific package, I can then use:

$ apt-cache show stella  
Package: stella
Priority: extra
Section: non-free/otherosfs
Installed-Size: 830
Maintainer: Tom Lear <>
Architecture: i386
Version: 1.1-2
Depends: libc6 (>= 2.1), libstdc++2.10, xlib6g (>= 3.3.5-1)
Filename: dists/potato/non-free/binary-i386/otherosfs/stella_1.1-2.deb
Size: 483430
MD5sum: 11b3e86a41a60fa1c4b334dd96c1d4b5
Description: Atari 2600 Emulator for X windows
  Stella is a portable emulator of the old Atari 2600 video-game console
  written in C++.  You can play most Atari 2600 games with it.  The latest
  news, code and binaries for Stella can be found at:

Note that apt-cache show might display more than one package in the case where you have one version installed, but there are newer versions available in the repository

General information about a package

Try using the following command:
     $ apt-cache showpkg penguin-command
     Package: penguin-command
     Reverse Depends: 
     1.4.5-1 - libc6 (2 2.2.1-2) libpng2 (0 (null)) libsdl-mixer1.1 (2 1.1.0) libsdl1.1 (0 (null)) zlib1g (2 1:1.1.3) 
     1.4.5-1 - 
     Reverse Provides:

And to just find out what packages it depends on:

     $ apt-cache depends penguin-command
       Depends: libc6
       Depends: libpng2
       Depends: libsdl-mixer1.1
       Depends: libsdl1.1
       Depends: zlib1g

To find the name of an installed package

To find out the names of packages installed on your system, which is useful, for example, if you plan to clean up your hard drive, you can run:

     # apt-cache search "Mozilla Web Browser"
     mozilla-browser - Mozilla Web Browser