RPM is a useful tool for both managing your system and diagnosing and fixing problems. The best way to make sense of all of its options is to look at some examples.
Perhaps you have deleted some files by accident, but you are not sure what you deleted. If you want to verify your entire system and see what might be missing, you could try the following command:
rpm -Va |
If some files are missing or appear to have been corrupted, you should probably either re-install the package or uninstall, then re-install the package.
At some point, you might see a file that you do not recognize. To find out which package owns it, you would enter:
rpm -qf /usr/X11R6/bin/ghostview |
The output would look like the following:
gv-3.5.8-22 |
We can combine the above two examples in the following scenario. Say you are having problems with /usr/bin/paste. You would like to verify the package that owns that program, but you do not know which package owns paste. Simply enter the following command:
rpm -Vf /usr/bin/paste |
and the appropriate package will be verified.
Do you want to find out more information about a particular program? You can try the following command to locate the documentation which came with the package that owns that program:
rpm -qdf /usr/bin/free |
The output would be like the following:
/usr/share/doc/procps-2.0.11/BUGS /usr/share/doc/procps-2.0.11/NEWS /usr/share/doc/procps-2.0.11/TODO /usr/share/man/man1/free.1.gz /usr/share/man/man1/oldps.1.gz /usr/share/man/man1/pgrep.1.gz /usr/share/man/man1/pkill.1.gz /usr/share/man/man1/ps.1.gz /usr/share/man/man1/skill.1.gz /usr/share/man/man1/snice.1.gz /usr/share/man/man1/tload.1.gz /usr/share/man/man1/top.1.gz /usr/share/man/man1/uptime.1.gz /usr/share/man/man1/w.1.gz /usr/share/man/man1/watch.1.gz /usr/share/man/man5/sysctl.conf.5.gz /usr/share/man/man8/sysctl.8.gz /usr/share/man/man8/vmstat.8.gz |
You may find a new RPM, but you do not know what it does. To find information about it, use the following command:
rpm -qip crontabs-1.10-5.noarch.rpm |
The output would look like the following:
Name : crontabs Relocations: (not relocateable) Version : 1.10 Vendor: Red Hat, Inc. Release : 5 Build Date: Fri 07 Feb 2003 04:07:32 PM EST Install date: (not installed) Build Host: porky.devel.redhat.com Group : System Environment/Base Source RPM: crontabs-1.10-5.src.rpm Size : 1004 License: Public Domain Signature : DSA/SHA1, Tue 11 Feb 2003 01:46:46 PM EST, Key ID fd372689897da07a Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> Summary : Root crontab files used to schedule the execution of programs. Description : The crontabs package contains root crontab files. Crontab is the program used to install, uninstall, or list the tables used to drive the cron daemon. The cron daemon checks the crontab files to see when particular commands are scheduled to be executed. If commands are scheduled, then it executes them. |
Perhaps you now want to see what files the crontabs RPM installs. You would enter the following:
rpm -qlp crontabs-1.10-5.noarch.rpm |
The output will look like the following:
Name : crontabs Relocations: (not relocateable) Version : 1.10 Vendor: Red Hat, Inc. Release : 5 Build Date: Fri 07 Feb 2003 04:07:32 PM EST Install date: (not installed) Build Host: porky.devel.redhat.com Group : System Environment/Base Source RPM: crontabs-1.10-5.src.rpm Size : 1004 License: Public Domain Signature : DSA/SHA1, Tue 11 Feb 2003 01:46:46 PM EST, Key ID fd372689897da07a Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> Summary : Root crontab files used to schedule the execution of programs. Description : The crontabs package contains root crontab files. Crontab is the program used to install, uninstall, or list the tables used to drive the cron daemon. The cron daemon checks the crontab files to see when particular commands are scheduled to be executed. If commands are scheduled, then it executes them. |
These are just a few examples. As you use it, you will find many more uses for RPM.