How to Check a Package is Installed or Not in Linux

Linux is a very popular and widely used free, open-source operating system. It is a very simply implemented yet very powerful operating system. Many services use Linux for many different dedicated purposes. For example, the majority of the web server uses Linux as a backend operating system.

One of the most useful and powerful features of Linux is the command line. Everything about computing you can handle within your Linux powerful command line.

In this tutorial, we will learn how to check if a software or service is installed or not in your installed package list using the command line tool.

Linux comes with several distros and every distro comes with some unique features and flavor. Every distro consists of some difference in the command line features and command. We will learn about some popular distros like Arch Linux,  Linux Ubuntu, Mint, Open Suse, Fedora, CentOS, etc.

Check if a Package is installed or Not

Different kinds of Linux distros have different kinds of flavor and unique features. The commands are also varied package to package.

Ubuntu / Debian / Mint

Ubuntu, Debian, and Mint are the most popular Linux distros. It has many features and simple interface yet those are very powerful open source os ever. These kinds of OS are widely used for GUI desktop users. You can easily install or remove a software package using the software manager or using the following command:

sudo apt-get update             //  apt update
sudo  apt-get upgrade            //  apt upgrade
sudo  apt-get dist-upgrade       //  apt full-upgrade
sudo apt-get install package    //  apt install package
sudo apt-get remove package     //  apt remove package
sudo  apt-get autoremove         //  apt autoremove
sudo apt-cache search string    //  apt search string

 

Check a package is installed or not

Check if a specific package is installed or not

You can find if a package or software is already installed or not on your local system you can use the following commands in your command line.

sudo  apt-cache policy package   // apt list -a package
sudo apt-cache show package     //  apt show package
sudo apt-cache showpkg package   //  apt show -a package

or

dpkg -s erlang     // check a package details
dpkg-query -l     // short information about a package
dpkg --list | grep erlang // list of subpackage installed under a package
dpkg --list      // show all the package

 

The above commands work on most likely Debian, mint and Ubuntu distribution. Try to command on different Linux package distribution.

Fedora / RHEL / CentOS / SUSE

On Fedora, RHEL and CentOS have some common command line operation in order to check installed packages and their info. You can try:

rpm -qa | grep erlang      // check package information
rpm -qa | grep -i erlang    // check package information in details
rpm -pa      // check all the installed package list on your system

For specific distro like CentOS supports additional command utility. For checking installed package information try in CentOS command line:

yum list installed|grep 'erlang' // check package info

For Fedora OS you can also try dnf command beside rpm command.

dnf list erlang // check package info on Fedora
dnf list package* // check all the installed package

On SUSE or Open SUSE, you can also use the following commands. Let’s try:

zypper search erlang // check package information
or
zypper se nano  // check package information

 

Arch Linux

On Arch Linux, you can use the pcman command to check the package information. Let’s try:

pacman -Qs nano // check package info on Arch Linux

 

Free BDS / Other BDS

On Free BDS we can use the following command to do this:

pkg info -Ix erlang   // check package information

Hope that it worked! good luck.