How to check whether or not a package is installed

Sometimes, we need to know whether or not some packages are being installed on the system. And the command which will let us find out the answer is different from one distro to another. So, we will see how to do it on the most popular distros.

Suppose you want to find out package coreutils or shred is installed or not.


On the distros that use the tool APT to manage their packages, like Debian and its based distros: (such as: Ubuntu / Linux Mint / Elementary OS / Linux Lite / deepin / antiX / Zorin OS / LXLE / Peppermint OS / SparkyLinux)

To list all the installed packages with dpkg:

$ dpkg --list | less

To query whether or not coreutils is installed:

$ dpkg --status 'coreutils'

or, use wildcards:

$ dpkg --status 'core*'

To search for a filename from the installed packages, for example shred is part of the coreutils package:

$ dpkg --search 'shred'

To see whether or not shred or coreutils is installed:

$ dpkg --list shred coreutils

Or, the grep way:

$ dpkg --list | grep -iE 'shred|coreutils'

See the manual:

$ man dpkg

Or read it online: dpkg(1)


On distros that use the tool RPM to manage their packages: (like: red hat / SUSE / openSUSE / CentOS / Fedora / Mageia / Scientific Linux / Korora Project)

To list all the installed packages with rpm:

$ rpm -qa | less

To check whether coreutils is installed or not:

$ rpm -qa 'coreutils'

or, use wildcards:

$ rpm -qa 'core*'

To see whether or not shred or coreutils is installed:

$ rpm -qa shred coreutils

Or, the grep way:

$ rpm -qa | grep -iE 'shred|coreutils'

See the manual:

$ man rpm

Or read it online: rpm(8)


On distros that use the tool PACMAN to manage their packages: (like: Arch Linux / Manjaro Linux / Antergos / KaOS / ArchBang Linux / BlackArch Linux / Parabola GNU/Linux-libre / Chakra GNU/Linux)

To list all the installed packages with pacman:

$ pacman -Q | less

To check whether coreutils is installed or not:

$ pacman -Qs coreutils

To see whether or not shred or coreutils is installed:

$ pacman -Qs shred coreutils

Or, the grep way:

$ pacman -Qs | grep -iE 'shred|coreutils'

See the manual:

$ man pacman

Or read it online: pacman(8)


On distros that use the tool Gentoo to manage their packages: (like: SabayonCoreOSCalculate Linux)

To list all the installed packages with ls & cut:

$ ls -d /var/db/pkg/*/*| cut -f5- -d/ | less

To display all packages you directly installed:

$ cat /var/lib/portage/world | less

To check whether coreutils is installed or not:

$ ls -d /var/db/pkg/*/*| cut -f5- -d/ | grep -i 'coreutils'

To see whether or not shred or coreutils is installed:

$ ls -d /var/db/pkg/*/*| cut -f5- -d/ | grep -iE 'shred|coreutils'

On BSD based systems (e.g: FreeBSD / GhostBSD / DragonFly BSD)

For FreeBSD >= 10.x:

To list all the installed packages with pkg:

$ pkg info | less

To search for a filename from the installed packages, for example gshred is part of the coreutils package:

$ pkg which `which gshred`

To check whether coreutils is installed or not:

$ pkg info -x coreutils

or, use wildcards:

$ pkg info -x 'core*'

To see whether or not shred or coreutils is installed:

$ pkg info | grep -iE 'gshred|coreutils'

See the manual:

$ man pkg

Or read it online: pkg(8)

For FreeBSD < 10.x:

To list all the installed packages with pkg_info:

$ pkg_info | less

To search for a filename from the installed packages, for example gshred is part of the coreutils package:

$ pkg_which `which gshred`

To check whether coreutils is installed or not:

$ pkg_info -x coreutils

or, use wildcards:

$ pkg_info -x 'core*'

To see whether or not shred or coreutils is installed:

$ pkg_info | grep -iE 'gshred|coreutils'

See the manual:

$ man pkg_info

Or read it online: pkg_info(1)


On MacOSX:

To list all the installed packages with port:

$ port installed | less

To check whether coreutils is installed or not:

$ port installed coreutils

To see whether or not shred or coreutils is installed:

$ port installed shred coreutils

Or, the grep way:

$ port installed | grep -iE 'shred|coreutils'

See the manual:

$ man port

Or read it online: port(1)

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.