The rpm command is fairly simple to use, once you understand the various switches and arguments. The command structure looks like this:
rpm [ACTION/OPTION] FILENAME.rpm
There are two types of actions: Querying, Installing/Upgrading/Removing. A query option is used when you want to know if a package is installed on a machine and what version is installed. The install/upgrade/remove action is used to install, remove, or upgrade a package. NOTE: Any of the installing, upgrading, removing commands must be run as root. The query command can be run as a standard user.
To check to see if a package is installed on your machine you would issue the command rpm -q package_name. Notice you do not add the "rpm" extension at the end of the package name. If you issue the command rpm -q gnome-terminal you might see the results:
gnome-teriminal-2.24.2-2.fc10.i386
If gnome-terminal was not installed on your machine you would see:
"package gnome-terminal is not installed"
Say you have downloaded an rpm file to install (We'll go with aterm-1.0.1-4.i386.rpm). If you want to install you would issue the command:
rpm -i aterm-1.0.1-4.i386.rpm
and the package would install. Running the above command however, will give you no feedback. I like to add a couple of switches so I know what is going on. By adding the v (for verbose output) and the h (for displaying "#" symbols for progression of installation) I would see something like you see below. First the command:
rpm -ivh aterm-1.0.1-4.i386.rpm
and now the output:
Preparing... ################################################[100%]
1: aterm ################################################ [100%]
Once the installation is done you will be back at your command prompt.
Now let's say you want to remove aterm. To remove a package with rpm you would use the "-e" switch like so:
rpm -h aterm
and aterm would be removed. NOTE: You can not use the "v" and "h" arguments with the "e" argument.