In all of the following examples, the vh options are simply so you get a nice verbose, human readable (i.e. progress bar) output when rpm runs.
Search for an installed package:
rpm -q [package]
In the above example you need to know the exact package name. If you don't know the exact name, you can query all packages and pipe the output through grep:
rpm -qa | grep [package]
Here's an example of the differences between these last 2 commands:
wherever:/home/whoever # rpm -q java package java is not installed wherever:/home/whoever # rpm -q java* package java* is not installed wherever:/home/whoever # rpm -q java2 java2-1.4.2-129.7 wherever:/home/whoever # rpm -qa | grep java java2-1.4.2-129.7 java2-jre-1.4.2-129.7
Install a package:
rpm -ivh [package]
Upgrade a package:
rpm -Uvh [package]
Delete a package:
rpm -evh [package]
Build a source package:
rpm --rebuild [source]
That last command rebuilds the source file and places the resulting rpm in /usr/src/RPM/RPMS/i586/ (or similar. That particular example was for Mandrake v8.2 on an i586 system). Note that the latest version of rpm provides a different program for building from source.
rpmbuild --rebuild [source]
Build and install a source package:
rpmbuild -ivh --rebuild [source]