RPM: SPECIAL TRICKS
There is a lot more to the rpm command then you might suspect on first sight. What I want to do in this tip is to cherry pick some real nice nuggets from the endless list of options.
You probably already know the most basic way to install/upgrade an RPM package:
Installing:
CODE |
# rpm -ivh amarok-1.4.1-4mdk.i586.rpm |
Upgrading:
CODE |
# rpm -Uvh amarok-1.4.1-4mdk.i586.rpm |
Removing:
But now for the special tricks, did you know you can also let the rpm command download and install the file for you ? ( works on http and ftp ):
CODE |
# rpm -ivh http://kev.coolcavemen.com/static/repository/mandriva/2006.0/RPMS/amarok-1.4.1-4mdk.i586.rpm |
And that you can downgrade the package you installed ( because the new one has a bug ? ):
CODE |
# rpm -Uvh --oldpackage amarok-1.3.1-3mdk.i586.rpm |
You can get detailed information on the package before installing it:
CODE |
# rpm -qip amarok-1.4.1-4mdk.i586.rpm |
This even works on a file you did not yet download:
CODE |
# rpm -qip http://kev.coolcavemen.com/static/repository/mandriva/2006.0/RPMS/amarok-1.4.1-4mdk.i586.rpm |
Also, you can get a complete list of all the files a package will install:
CODE |
# rpm -qlp amarok-1.4.1-4mdk.i586.rpm |
And sure this works on a file you have not yet download too:
CODE |
# rpm -qlp http://kev.coolcavemen.com/static/repository/mandriva/2006.0/RPMS/amarok-1.4.1-4mdk.i586.rpm |
Now 4 commands to get some info on packages that are already installed . . . first put a complete listing in your /home:
CODE |
# rpm -qa | sort -f > installed_rpms.txt |
( Note: There is a nice Tip at Distrowatch showing how to get a package list in other distros )
Here is how you get info on a single package:
And a full list of the files belonging to an installed package:
Finally if you are curious what package installed a file you found on your computer:
CODE |
# rpm -qf /usr/share/apps/zeroconf/_shoutcast._tcp |
Well, you'll have to admit, the rpm command is pretty versatile . . . . and there is more, just have a look at "man rpm" and you will see there is at least a hundred different options listed.

Bruno
-- Oct 14 2006 --