File command Linux package name

2

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

paultop6

Posted 2012-06-11T09:49:31.587

Reputation:

Try sudo yum install file. – jww – 2016-07-03T12:44:07.833

Answers

2

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

Dmitri Chubarov

Posted 2012-06-11T09:49:31.587

Reputation: 614

1The 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 – 2016-07-03T12:40:12.237

@jww edited the post – Dmitri Chubarov – 2016-07-06T18:25:06.257

1Replace rpm -q with dpkg -S in debian/ubuntu/derivates – Miquel – 2012-06-11T14:11:31.530