How to Querying the RPM database – tuxfiles.org

Installing software from RPM packages in Linux
How to Querying the RPM database

As you already know, the RPM database contains a list of all installed RPM packages on your system. You can query this database to get info of the packages on your Linux system. To query a single package, you use the -q option. For example, to query a package whose name is “software”:
# rpm -q software

After issuing this command, rpm either tells you the version of the package, or that the package isnt installed.

If you want a list of all packages installed on your system, youll have to query all with -qa:
# rpm -qa

Most likely this list will be very long, so youll need a way to scroll it. The best way is to pipe the list to less:
# rpm -qa | less

If youre looking for packages whose names contain a specific word, you can use grep for finding those packages. For example, to get a list of all installed RPM packages whose names contain the word “kde”, you could do something like this:
# rpm -qa | grep kde

The above command makes rpm list all packages in its database and pass the list to grep. Then grep checks every line for “kde” and finally shows you all the lines that contain the word “kde”.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s