≡ Menu

Find out if package is installed in Linux

The command to finding out if package is installed in Linux is depend upon your Linux distribution. Following are commands for different distributions.

Jump to your distribution:
* Debian / Ubuntu Linux

* Red Hat / Fedora Linux / Cent OS / Suse Linux

Debian / Ubuntu Linux

Use dpkg command, which is package manager for Debian. Suppose you want to find out package apache-perl or sudo is installed or not, type command:
$ dpkg -s apache-perl
$ dpkg -s sudo

Package: sudo
Status: install ok installed
Priority: optional
Section: admin
Installed-Size: 396
Maintainer: Bdale Garbee 
Architecture: i386
Version: 1.6.8p12-4
Replaces: sudo-ldap
Depends: libc6 (>= 2.3.5-1), libpam0g (>= 0.76), libpam-modules
Conflicts: sudo-ldap
/etc/pam.d/sudo e3aaa79c2a00244cdfd17117127f8993
/etc/init.d/sudo 64f882a713108e70dc6133444177281f
Description: Provide limited super user privileges to specific users
Sudo is a program designed to allow a sysadmin to give limited root
privileges to users and log root activity.  The basic philosophy is to give
as few privileges as possible but still allow people to get their work done.
This version is built with minimal shared library dependencies, use the
sudo-ldap package instead if you need LDAP support.

Use file /var/lib/dpkg/available to find out all package names available to you. Or you can use following command (list all packages in /var/lib/dpkg/status):
$ dpkg-query -l
You can also try to match package name using wild cards:
$ dpkg-query -l 'libc6*'
Once you’ve found package name, use the following command to get exact status (whether it is installed or not):
$ dpkg-query -W -f='${Status} ${Version}\n' apache-perl

install ok installed 1.3.34-2

Red Hat Enterprise / Fedora Linux / Suse Linux / Cent OS

Under Red Hat/Fedora Linux use rpm command:
$ rpm -qa | grep {package-name}
For example find out package mutt installed or not:
$ rpm -qa | grep mutt


If you don’t get any output ( package name along with version), it means package is not installed at all. You can display list all installed packages with the following command:
$ rpm -qa
$ rpm -qa | less

See also:

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 10 comments… add one }
  • Amardeep February 9, 2007, 10:06 am

    Hi to all,

    This is my first massage over here& i hope i will get full support.

    How to open usermap.cfg file on NetApp server?- As i have to check whether unix user login is mapped correctly with Windows login.

    As the main problem which few of the users are having is as below —

    They are NOT able to map from Windows any network
    drive (unix accounts) due to they have not access to their share drive.

    It ask me for login and password, BUT earliear it never asked me for my windows login and password . It’s been working till the end of the year 2006.

    Please suggest solutions—–

    Many thanks in Advance


  • Niels Dettenbach September 14, 2010, 2:30 pm

    just a small addition –

    on Gentoo Linux just do a:

    qlist -I

    cat /var/lib/portage/world

    on CentOS or other “yum”-based systems:

    yum list installed

  • john September 7, 2011, 11:40 am

    how to see the programs and features in redhat linux (e.g– in windows we can check the same through control panel–progrmas)

  • Niels Dettenbach September 7, 2011, 2:02 pm

    @john: On RedHat – which is a rpm package management based distribution – you should can use i.e.:

    rpm -qa

    to list all installed packages or

    rpm -qi

    to get out details about the installed package.


    Niels Dettenbach
    Syndicat – IT & Internet

  • mahen March 21, 2012, 11:21 am

    how do i verify packages that are installed without using rpm, i mean recently i installed squid using make, make all, configure configure-install

    after this, how do I check this package is installed?

    • Niels Dettenbach March 21, 2012, 11:35 am

      …this is not possible as installing “by hand” (make install) has nothing to do with a “package” nor package management.

      To find out if i.e. squid was installed just try to locate the squid binary by where, locate or find, even if you build and install software from sources by make.

      If you use a port management system from i.e. pkgsrc, getoo portage or even FreeBSD the port management counts each modified and installed file of a port to make it possible to see which file belongs to which port (package) or which are installed etc.

      this might be another story.

  • rifu May 6, 2013, 2:52 pm

    Thank you very much, I have another issue, I have Installed texlive but I still get an error message in my crm ” pdf latex not installed”, so do you know how check if any software is installed or not ? It’s different from packages, isn’t it ?

    Thank you

  • Ken Williams April 11, 2014, 3:38 pm

    If you have a list of packages you want to query, it’s much easier to just list them instead of using grep:

    rpm -q automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel

  • Brendan Long July 1, 2014, 7:13 pm

    Why such a complicated command for rpm-based systems? On my machine (Fedora 20), I can just run rpm -q ${package_name}, and it’s *much* faster since it doesn’t need to list every package on the system and then grep through it:

    [blong@blong-desktop tmp]$ rpm -q vala; echo $?
    [blong@blong-desktop tmp]$ rpm -q missing-package; echo $?
    package missing-package is not installed

    Is this a new feature?

  • Eric Sebasta October 11, 2015, 3:17 pm

    In Debian based distros like Ubuntu, you can find out if a package is installed with:

    apacheInstalled=$(dpkg -s apache2 | grep ‘Status: install ok installed’| wc -l)
    #change apache2 to the package you are checking for. returns 1 if installed, 0 otherwise.
    #script does not have to be running as root… but to change installed stuff… it would.

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: