This question already has an answer here:

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?

marked as duplicate by Gilles, jasonwryan, slm Mar 24 '15 at 0:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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.

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 '15 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 '15 at 13:40
  • It's yum provides ... that works with file globs. – goldilocks Mar 23 '15 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 '15 at 14:20
  • @ChrisDown I'm guessing a "just give me the codes, I don't want any explanations" attitude. – goldilocks Mar 23 '15 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 or ask your own question.