4

I can't find out which package provides the file on CentOS 6.

2
  • Try sudo yum install file.
    – jww
    Jul 3, 2016 at 12:44
  • Use sudo dnf install file. Mar 14 at 13:54

1 Answer 1

4

If you had file installed on one of your systems, than the following command would have answered your question

 rpm -q --whatprovides `which file`

In CentOS and other RedHat derived distributions the name of the package is file

 $ rpm -q --whatprovides `which file`
 file-5.04-13.el6.x86_64

Edit 2 (after a comment from jww)

To install file type

 sudo yum install file

Edit 1 As @Miquel reminds in Debian and Ubuntu one can use dpkg-query -S:

 $ dpkg-query -S `which file`
 file: /usr/bin/file
3
  • 1
    Replace rpm -q with dpkg -S in debian/ubuntu/derivates
    – Miquel
    Jun 11, 2012 at 14:11
  • 1
    The file progam is missing on CentOS 6 and 7: /usr/bin/which: no file in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin) I don't believe we can use which to locate it. And rpm -q --whatprovides "/usr/bin/file" results in error: file /usr/bin/file: No such file or directory.
    – jww
    Jul 3, 2016 at 12:40
  • @jww edited the post Jul 6, 2016 at 18:25

You must log in to answer this question.