For Debian - what package does that file belong to?

Published on 2010-01-12.

On Debian it is easy to find out what package a specific program or file belongs to even if the package isn't installed.

You need to install the utility called apt-file.

# apt-get install apt-file

Now, if you wanted to find out what package the program fuser belongs to. You can do that using the apt-file utility:

# apt-file search fuser
atfs-dev: /usr/share/man/man3/af_afuser.3.gz
crash-whitepaper: /usr/share/doc/crash-whitepaper/doc/help_pages/fuser.html
fish: /usr/share/fish/completions/fusermount.fish
fuse-utils: /usr/bin/fusermount
fuse-utils: /usr/share/man/man1/fusermount.1.gz
gforge-web-apache: /usr/share/gforge/www/pm/ganttofuser.php
kde-guidance: /usr/share/apps/guidance/fuser.pyc
kde-guidance: /usr/share/apps/guidance/fuser_ui.pyc
kde-guidance: /usr/share/apps/guidance/fuser_ui.ui
kde-guidance: /usr/share/python-support/kde-guidance/fuser.py
kde-guidance: /usr/share/python-support/kde-guidance/fuser_ui.py
manpages-fi: /usr/share/man/fi/man1/fuser.1.gz
manpages-it: /usr/share/man/it/man1/fuser.1.gz
manpages-ja: /usr/share/man/ja/man1/fuser.1.gz
manpages-ja: /usr/share/man/ja/man8/ifuser.8.gz
manpages-nl: /usr/share/man/nl/man1/fuser.1.gz
manpages-pl: /usr/share/man/pl/man1/fuser.1.gz
manpages-posix: /usr/share/man/man1/fuser.1posix.gz
pcmcia-cs: /sbin/ifuser
pcmcia-cs: /usr/share/man/man8/ifuser.8.gz
psmisc: /bin/fuser
psmisc: /usr/bin/oldfuser
psmisc: /usr/share/man/man1/fuser.1.g
...

In this case a lot of different filenames are returned (and I have shortened the list), but since fuser is an executeable file, it is relativelly easy to spot it because it has to be located in a bin directory, and the right package is:

psmisc: /bin/fuser

So in order to get our hands on fuser we need to install the psmisc package.

Another nice feature of the apt-file utility is that it can display all files in a specific package even if the package isn't installed.

If we want to figure out what files will get installed, if we install the psmisc package, we can do that using the list option:

# apt-file list pmisc
psmisc: /bin/fuser
psmisc: /usr/bin/killall
psmisc: /usr/bin/oldfuser
psmisc: /usr/bin/pstree
psmisc: /usr/bin/pstree.x11
psmisc: /usr/share/doc/psmisc/README
psmisc: /usr/share/doc/psmisc/README.Debian
psmisc: /usr/share/doc/psmisc/changelog.Debian.gz
psmisc: /usr/share/doc/psmisc/changelog.gz
psmisc: /usr/share/doc/psmisc/copyright
psmisc: /usr/share/locale/bg/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/ca/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/de/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/eu/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/fi/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/fr/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/hu/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/it/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/ja/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/nb/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/nl/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/pl/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/pt/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/ro/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/sv/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/locale/vi/LC_MESSAGES/psmisc.mo
psmisc: /usr/share/man/man1/fuser.1.gz
psmisc: /usr/share/man/man1/killall.1.gz
psmisc: /usr/share/man/man1/pstree.1.gz
psmisc: /usr/share/man/man1/pstree.x11.1.gz
psmisc: /usr/share/menu/psmisc
psmisc: /usr/share/pixmaps/pstree16.xpm
psmisc: /usr/share/pixmaps/pstree32.xpm

Take a look at man apt-file for further information.