These two commands tell you which package owns a particular file for an RPM or DEB based system respectively.
rpmquery –whatprovides <path-to-file>
dpkg-query –search <path-to-file>
(The short form for dpkg is -S)
To list the files owned by a package use:
rpmquery –list <package>
dpkg-query -L <package>
(This long form for debian is –listfiles )
A useful utility to find all the other files in a package for a given binary (in this case lsof) is:
rpmquery –list $(rpmquery –whatprovides $(which lsof ) )
Or
dpkg-query -L $(dpkg-query –search $( which lsof ) | sed ‘s!\:.*!!’ )