Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : Linux : Education - Tutorials
LPI certification 102 exam prep, Part 1
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
5. rpm, the (R)ed Hat (P)ackage (M)anager
  


Finding the owner for a file page 11 of 16


Sometimes it's useful to find out what rpm owns a given file. In theory, you could figure out what rpm owns /usr/X11R6/bin/xsnow (pretend you don't remember) using a shell construction like the following:


# rpm -qa | while read p; do rpm -ql $p | grep -q '^/usr/X11R6/bin/xsnow$' && echo $p; done
xsnow-1.41-1

Since this takes a long time to type, and even longer to run (1m50s on one of our Pentiums), the rpm developers thoughtfully included the capability in rpm. You can query for the owner of a given file using rpm -qf:


# rpm -qf /usr/X11R6/bin/xsnow
xsnow-1.41-1

Even on the Pentium, that only takes 0.3s to run. And even fast typists will enjoy the simplicity of rpm -qf compared to the complex shell construction :)


Main menuSection menuFeedbackPreviousNext
Privacy Legal Contact