How to view which package a file belongs to under CentOS

Time:2019-12-10

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

$ yum provides /etc/passwd

perhaps

$ 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 >