Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
General Linux > Get Started > Issue <<  25 of 376 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 199
Last update: 05-11-06
Issue:
How do I use RPM? What are some general commands that I will use with this application? Also, for whatever reason, I think files have changed on my system but I do not know which ones. Can RPM help?
Resolution:
In general, normal usage of the rpm command can be summarized with installation, upgrading, removal and querying. Below you will find the common usage of the rpm command as well as some of the options.
  • Installation/Upgrading/Removal
    • To install a package: rpm -ivh <filename>
      rpm -ivh somepackage.x.y-z.<arch>.rpm
    • To upgrade a package: rpm -Uvh <filename>
      rpm -Uvh somepackage.1.1-5.i386.rpm
    • To remove a package: rpm -e <packagename>
      rpm -e somepackage
    • Note: Red Hat Enterprise Linux is multi-lib capable. If you have packages installed for multiple architectures you can remove a package for a specific architecture with the following syntax: rpm -e <packagename.version.arch>

       rpm -e somepackage.1.1-5.x86_64 
    • Also, for upgrading or installing some packages, you may need to use additional flags to force the install to occur. It is only recommended to use these if you know why these flags were needed.
      --force    will overwrite files that are owned by other packages.
      --nodeps   will install even if the package needs packages that were not installed.
  • Querying
    • To see if a package is installed: rpm -q <packagename>
      rpm -q somepackage
    • To get info on an installed package: rpm -qi <packagename>
      rpm -qi somepackage
    • To list which files belong to a package: rpm -ql <packagename>
      rpm -ql somepackage
    • To see what package a file belongs to: rpm -qf <path-to-filename>
      rpm -qf /usr/bin/some_executable

One can usually join various query commands together, so rpm -qil will give info and list all the files in the package.

To look at an RPM filename that is not installed, you add the p to the query line.

rpm -qilp somepackage.1.1-4.i386.rpm

This will list the information and the files contained in <somepackage>. More advanced usage can be found in the man page for RPM and at the website, http://www.rpm.org.

Verification

To see what files on the system may have changed from their initial settings, you can use RPM to check up on them.

The command rpm -Va will give you a list of all files that have changed in one form or another since the package associated with it was installed. This can be a lot of files (and a lot may be changed due to post installation work). To just see what packages have changed so that you can verify them more individually, you can do the following:

rpm -Va --pipe "awk '{print $2}' | xargs rpm -qf | sort -u" &> /tmp/file1

Then look in the file /tmp/file1 to see all of the packages that have been changed after their installation.


How well did this entry answer your question?


good wrong incomplete out of date
General Linux > Get Started > Issue <<   25  of  376  >>