Skip to main content

Find Out What Package Provides a File / Command (Debian / Ubuntu / RHEL / Fedora / CentOS Linux)

Requirement

How do I find out what package provides a file called /bin/ls?

Solution:

Redhat / Fedora / CentOS:

Use the rpm -qf command to find out the package name

Example output:

$ rpm -qf /bin/ls
coreutils-8.4-19.el6.x86_64

Debian / Ubuntu:

Option 1: dpkg

Use the dpkg -S command to find out the package name

$ dpkg -S /bin/ls
coreutils: /bin/ls

You can also obtain detailed status information about coreutils package:

$ dpkg -s coreutils
Package: coreutils
Essential: yes
Status: install ok installed
Priority: required
Section: utils
Installed-Size: 6020
Maintainer: Ubuntu Developers <[email protected]>
Architecture: amd64
Multi-Arch: foreign
Version: 8.21-1ubuntu5.1
Replaces: mktemp, timeout
Pre-Depends: libacl1 (>= 2.2.51-8), libattr1 (>= 1:2.4.46-8), libc6 (>= 2.17), libselinux1 (>= 1.32)
Conflicts: timeout
Description: GNU core utilities
 This package contains the basic file, shell and text manipulation
 utilities which are expected to exist on every operating system.
 .
 Specifically, this package includes:
 arch base64 basename cat chcon chgrp chmod chown chroot cksum comm cp
 csplit cut date dd df dir dircolors dirname du echo env expand expr
 factor false flock fmt fold groups head hostid id install join link ln
 logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc od
 paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir runcon
 sha*sum seq shred sleep sort split stat stty sum sync tac tail tee test
 timeout touch tr true truncate tsort tty uname unexpand uniq unlink
 users vdir wc who whoami yes
Homepage: http://gnu.org/software/coreutils
Original-Maintainer: Michael Stone <[email protected]>

Option 2: dpkg-query

dpkg-query has a similar syntax as dpkg:

$ dpkg-query -S '/bin/ls'
$ dpkg-query -S 'passwd*'
$ dpkg-query --search '/path/to/file'

Option 3: apt-file

apt-file is a command needs installing. Just install it by using apt-get:

# apt-get install apt-file
# apt-file update

Use apt-file to search for a file, just enter:

$ apt-file search date

Ref: http://www.cyberciti.biz/faq/equivalent-of-rpm-qf-command/

Comments

Comments powered by Disqus