How to view which package a file belongs to under CentOS


1. Under CentOS / RedHat, check which RPM package a file or command belongs to:

$ yum provides /etc/passwd


$ rpm -qf /etc/passwd

2. Ubuntu and derivative:

Sudo dpkg – s where is or

sudo dpkg-query -S /usr/bin/whereis

Refer to the Ubuntu wiki skills page for details, but the command is not as powerful as rpm-qf, such as / etc / passwd.

3. Gentoo and derivative

#Files not installed

e-file qmake

#View installed files

equery b <filename>

Or qfile < filename >