Monday, July 16, 2007

RPM commands

RPM is a great packager, but it might be difficult to interogate it. So here is a summary of the command I used most :

Find out which package contains a file :
$ rpm -qf /usr/bin/vim
vim-enhanced-6.3.086-0.fc4

List files in an installed package :
$ rpm -ql vim-enhanced-6.3.086-0.fc4
/etc/profile.d/vim.csh
/etc/profile.d/vim.sh
/usr/bin/ex
/usr/bin/rvim
/usr/bin/vim
/usr/bin/vimdiff
/usr/bin/vimtutor
/usr/share/man/man1/rvim.1.gz
/usr/share/man/man1/vimdiff.1.gz
/usr/share/man/man1/vimtutor.1.gz

Find which files a package contains :
$ ls vim-enh*
vim-enhanced-6.3.071-3.i386.rpm
$ rpm -qpl vim-enhanced-6.3.071-3.i386.rpm
/etc/profile.d/vim.csh
/etc/profile.d/vim.sh
/usr/bin/ex
/usr/bin/rvim
/usr/bin/vim
/usr/bin/vimdiff
/usr/bin/vimtutor
/usr/share/man/man1/rvim.1.gz
/usr/share/man/man1/vimdiff.1.gz
/usr/share/man/man1/vimtutor.1.gz