Debian / Ubuntu Linux Find Out What Package Provides a File
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 DevelopersArchitecture: 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:
- How do I add jobs to cron under Linux or UNIX oses?
- Linux / UNIX: Getting help with man page
- Upgrade WHM / cPanel Linux server to EDGE release
- Linux Force DHCP client (dhclient) to renew ip address
- What command do you run to check file system consistency under UNIX or Linux?
Discussion on This FAQ
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!
Tags: core utilities, debian packages, dpkg, dpkg -S, dpkg command, dpkg-query --search, dpkg-query -S, dpkg-query command, equivalent command, Equivalent of rpm -qf, option search, query command, rpm, rpm -qf, rpm command, system utilities ~ Last updated on: March 13, 2008



April 15th, 2008 (4 weeks ago) at 6:21 pm
May I suggest you (apt-file):
http://debaday.debian.net/2007/01/24/apt-file-search-for-files-in-packages-installed-or-not/