linux下查看某个文件属于哪个包

1、centos/redhat下查看某个文件或命令属于哪个rpm包:

$ yum provides /etc/passwd
或者
$ rpm -qf /etc/passwd

2、ubuntu及衍生版:

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

具体参考ubuntu wiki skills页面 ,不过该命令不如rpm -qf强大,如/etc/passwd就查不出。

3、gentoo及衍生版

#未安装的文件
e-file qmake
#已安装的文件查看
equery b <filename>
qfile <filename>



转自:http://www.361way.com/linux-packages-owning-file/2722.html
原文地址:https://www.cnblogs.com/z-books/p/6632546.html