I am using a minimal Debian system which does not have the top program installed. I tried to install top with sudo apt-get install top, but top is not a package name.

It seems that top is a part of some other package. How can I find out which package I should install to get it? More generally, how can I find the package that contains a program?

  • 1
    On a well-bloated Ubuntu system, running eg. laps when it isn't installed triggers the message "The program 'laps' is currently not installed. You can install it by typing: sudo apt-get install epix". Can you add that functionality to your system?
    – GKFX
    Mar 23, 2015 at 17:28
  • 2
    It's not thru apt, but there is a simple web interface that allows you to search for packages: debian.org/distrib/packages.
    – rm5248
    Mar 23, 2015 at 18:20
  • You can regex search the description of all the packages. It can also be helpful in other contexts than just finding a certain executable. In the following example the command dig is being searched for apt show '*' | grep --regexp '[^A-Za-z]dig[^A-Za-z]' --before-context 30 --after-context 5 --color=always | less --raw-control-chars
    – ossbuntu
    Oct 26, 2019 at 15:41

3 Answers 3


The direct answer is procps. Here is how you can find this out for yourself:

# Install apt-file, which allows you to search
# for the package containing a file
sudo apt-get install apt-file

# Update the package/file mapping database
sudo apt-file update

# Search for "top" at the end of a path
apt-file search --regexp '/top$'

The output of the final command should look something like this:

crossfire-maps: /usr/share/games/crossfire/maps/santo_dominion/magara/well/top
crossfire-maps-small: /usr/share/games/crossfire/maps/santo_dominion/magara/well/top
liece: /usr/share/emacs/site-lisp/liece/styles/top
lxpanel: /usr/share/lxpanel/profile/two_panels/panels/top
procps: /usr/bin/top
quilt: /usr/share/quilt/top

You can see that only procps provides an executable in your standard PATH, which gives a clue that it might be the right one. You can also find out more about procps to make sure like it seems like the right one:

$ apt-cache show procps
Package: procps
Version: 1:3.3.3-3


Description-en: /proc file system utilities
 This package provides command line and full screen utilities for browsing
 procfs, a "pseudo" file system dynamically generated by the kernel to
 provide information about the status of entries in its process table
 (such as whether the process is running, stopped, or a "zombie").
 It contains free, kill, pkill, pgrep, pmap, ps, pwdx, skill, slabtop,
 snice, sysctl, tload, top, uptime, vmstat, w, and watch.
  • 3
    I like this answer way more than the post the mods linked to. Without --regexp the search goes bananas with the results, as in +10000 results when searching for shortnamed commands, such as dig.
    – Fabián
    Aug 22, 2019 at 1:32
  • I totally forgot about apt-file search - super helpful thank you so much.
    – Sam Heuck
    May 21, 2021 at 19:23

You can search for things with apt-cache search ..., although it is just a match on package names and descriptions, which sometimes is not enough. In that case using, e.g.,

apt-file search top

might work -- it finds all packages that have a file with top in their name, but for this that is a bit zany (it includes setopt, .desktop, etc). To refine this as per Chris's answer:

apt-file search --regexp 'bin/top$'

This will find packages that have a file path ending ('$' is regular expression syntax signifying the end) in bin/top; executables are always in either a bin or sbin directory. When you find what you're looking for:

apt-get install whatever

In this case whatever is apparently procps.

  • By default, apt-file search takes a literal substring pattern to search for, not a glob. At least on my system, apt-file search "*/top" returns 0 results.
    – Chris Down
    Mar 23, 2015 at 13:31
  • @ChrisDown Yeah. I changed this to use --regexp and added an explanation that's absent from your otherwise very complete answer ;)
    – goldilocks
    Mar 23, 2015 at 13:40
  • It's yum provides ... that works with file globs.
    – goldilocks
    Mar 23, 2015 at 13:48
  • Whoever drive-by downvoted this answer and mine at the same time, I'm sure both me and goldilocks would appreciate some feedback instead of just blind downvoting :-)
    – Chris Down
    Mar 23, 2015 at 14:20
  • @ChrisDown I'm guessing a "just give me the codes, I don't want any explanations" attitude.
    – goldilocks
    Mar 23, 2015 at 14:44

apt-file search all repos listed in /etc/apt/sources.list and related databases, as long as repo serve a contents-%architecture%.gz.

if believe the file of interest is an executable name "top", use this regex. '^/(usr/)?s?bin/top$'

for the official debian repo, there is a web interface https://packages.debian.org/file:top, there are other search options.

Not the answer you're looking for? Browse other questions tagged .