[plug] Which RPM?

Anthony J. Breeds-Taurima tony at cantech.net.au
Fri Jun 9 16:07:30 WST 2000


On Fri, 9 Jun 2000, Earnshaw, Mike wrote:

> Lists,
> 
> Trying to find which RPM contains a file. Normally I would use:
> 
> rpm -qf <looking for> i.e. /bin/pwd
> 
> I am trying to find the rpm that contains the "patch" command but I
> can't seem to get it to work as I don't know where patch would live. I
> have tried /bin/patch and /sbin/patch

I haven't found a nice easy way to do this, By nice i mean just useing rpm
BUT you can do something like:

---
mount /mnt/cdrom
cd /mnt/cdrom/RedHat/RPMS
for i in *.rpm ; do 
	rpm -qlp $i 2>&1 | grep '/bin/pwd' && echo $i
done
---

This will give you output like

/bin/pwd
sh-utils-2.0-1.i386.rpm

Where sh-utils-2.0-1.i386.rpm is the rpm that contains the required file.

This was checked out with a 6.1 archive.

It's slow and requires a CD BUT will work.

The script above is basically copied from:
http://www.cantech.net.au/plug/2000-03/msg00011.html

with the addition suggested by Matt 
(See: http://www.cantech.net.au/plug/2000-03/msg00012.html)


Yours Tony.

/*
 * "The significant problems we face cannot be solved at the 
 * same level of thinking we were at when we created them."
 * --Albert Einstein
 */




More information about the plug mailing list