About Linux FAQ

Browse More FAQs:

Debian / Ubuntu Linux Find Out What Package Provides a File

Posted by Vivek on Thursday March 13, 08 @5:34 pm

Q. How do I find out what package provides a file called /bin/ls? I can use 'rpm -qf /bin/ls' command under Red Hat Linux to find out package name. Can you tell me equivalent command for the same under Debian Linux?

A. dpkg is a tool to install, build, remove and manage Debian packages. dpkg maintains some usable information about available packages. You can search for a filename from installed packages using dpkg -S command. For example, find out package name for /bin/ls, enter:
$ dpkg -S /bin/ls
Sample output:

coreutils: /bin/ls

You can also obtain detailed status information about coreutils package, enter:
$ dpkg -s coreutils
Sample output:

Package: coreutils
Essential: yes
Status: install ok installed
Priority: required
Section: utils
Installed-Size: 9040
Maintainer: Ubuntu Core Developers 
Architecture: i386
Version: 5.97-5.3ubuntu3
Replaces: textutils, shellutils, fileutils, stat, debianutils (<= 2.3.1), dpkg (<< 1.13.2)
Provides: textutils, shellutils, fileutils
Pre-Depends: libacl1 (>= 2.2.11-1), libc6 (>= 2.6-1), libselinux1 (>= 2.0.15)
Conflicts: stat
Description: The GNU core utilities
 This package contains the essential basic system utilities.
 .
 Specifically, this package includes:
 basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir
 dircolors dirname du echo env expand expr factor false fmt fold groups head
 hostid id install join link ln logname ls md5sum mkdir mkfifo mknod mv nice nl
 nohup od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
 sha1sum seq shred sleep sort split stat stty sum sync tac tail tee test touch
 tr true tsort tty uname unexpand uniq unlink users vdir wc who whoami yes
Original-Maintainer: Michael Stone 

dpkg-query command

You can also use dpkg-query command which is a tool to show information about packages listed in the dpkg database. The -S option search for a filename from installed packages. All standard shell wildchars can be used in the pattern. This command will not list extra files created by maintainer scripts, nor will it list alternatives.
$ dpkg-query -S '/bin/ls'
$ dpkg-query -S 'passwd*'
$ dpkg-query --search '/path/to/file'

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Linux / UNIX FAQ:

Discussion on This FAQ

  1. pepitu Says:

    May I suggest you (apt-file):
    http://debaday.debian.net/2007/01/24/apt-file-search-for-files-in-packages-installed-or-not/

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , , , , , , , , ~ Last updated on: March 13, 2008

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.