How to Check Whether a Package is Installed in Linux

By | October 27, 2008

Today I come with a short and simple command that will be useful for Linux newbies. What to do if you need to find out whether the package you need is already installed or not? There is a short command that will allow you to do this.

rpm -qa | grep <package>

What does this do? This command queries all installed rpms and sends them to grep that is able to tell us whether it is the package we need. For example, if we need to know whether httpd is installed (I mean rpm installations only, compiling apache from source has nothing to do with rpm), we need to enter this command:

rpm -qa | grep httpd

I think this command will be useful for you: you will always know what software you have installed on your server. If you need to list all the packages that are installed, you’re welcome to type:

rpm -qa

This command will list all the packages you have.