Figure out what rpm package a program is a part of

I am trying to figure out what rpm package a program is a part of. I have tried the normal way.

rpm -qa | grep -i programname

What other ways can you try?

You can use the -qf switch on the program filename:

rpm -qf /bin/ls
coreutils-8.4-19.el6.x86_64
2 Likes

Does this mean it was built from source on the server?

$ which sicsim
/usr/local/bin/sicsim
$ which sicasm
/usr/local/bin/sicasm
rpm -qf /usr/local/bin/sicsim
file /usr/local/bin/sicsim is not owned by any package
$ rpm -qf /usr/local/bin/sicasm
file /usr/local/bin/sicasm is not owned by any package

Yes that should mean it was not installed via package management. It could be precompiled binaries or built from source on the server. Also the path /usr/local is normally not used by packages, at least not on RedHat. I don't know what your distribution is?