Linux is an incredibly powerful operating system with a rich ecosystem of tools, applications, and utilities. One of its biggest strengths is package management — the process of installing, updating, removing, and querying software. But as a system administrator or even as a curious Linux enthusiast, one of the most common questions you’ll face is:
“How do I check if a package is already installed on my Linux system?”
It sounds simple, but the answer depends heavily on the Linux distribution you are using. Different Linux families rely on different package managers, and each has its own commands and syntax for verifying installed software.
In this article, we’ll explore every major package manager across popular Linux distributions. We’ll go step by step through commands for RHEL, CentOS, Fedora, Debian, Ubuntu, openSUSE, and Arch Linux systems. By the end, you’ll have a complete reference guide that you can use whether you’re troubleshooting a server, preparing a deployment script, or just checking your desktop system.
1. Why Checking Installed Packages Matters
Before diving into commands, let’s discuss why checking installed packages is important:
- Avoid redundant installs – You don’t want to waste time reinstalling software that’s already available.
- Dependency troubleshooting – Some applications depend on libraries or tools. Verifying their installation saves debugging time.
- Server migrations – When moving to a new machine, knowing the exact package list helps recreate environments consistently.
- System auditing – Security and compliance checks often require knowing what’s installed.
- Scripting automation – Scripts often need to verify presence of a tool before proceeding.
Linux makes all of this possible via package managers, the tools designed to interact with software repositories and the system’s package database.
2. Package Management in Linux at a Glance
There are several families of Linux distributions, each with its own package management ecosystem:
- RPM-based: Red Hat Enterprise Linux (RHEL), CentOS, Fedora, openSUSE → Tools:
rpm,yum,dnf,zypper - Debian-based: Debian, Ubuntu, Linux Mint → Tools:
dpkg,apt - Arch-based: Arch Linux, Manjaro, ArcoLinux → Tool:
pacman
Each package manager keeps a database of installed software, and querying that database is how we determine if something is installed.
Let’s look at each in detail.
3. Checking Installed Packages on RPM-Based Systems
3.1 Using the rpm Command
The rpm tool is the low-level package manager for RPM-based distributions. It directly queries the RPM database without involving repositories.
To list all installed packages:
rpm -qa
This outputs every installed package. To include installation dates:
rpm -qa --last
Example output:
jdk-9.0.1-9.0.1-ga.x86_64 Wed 25 Oct 2017 05:14:11 PM IST
kernel-debug-devel-4.12.14-300.fc26 Sat 30 Sep 2017 10:02:36 PM IST
SDL-1.2.15-25.fc26.x86_64 Sat 30 Sep 2017 10:02:28 PM IST
To check if a specific package is installed:
rpm -q package_name
For example:
rpm -q nano
If installed, you’ll see the package name and version. Otherwise:
package nano is not installed
3.2 Using the yum Command (RHEL 7, CentOS 7)
yum (Yellowdog Updater, Modified) is the traditional higher-level package manager for RHEL and CentOS 7. It interacts with repositories, resolves dependencies, and manages packages.
To list installed packages:
yum list installed
Sample output:
Installed Packages
nano.x86_64 2.3.1-10.el7 @base
git.x86_64 1.8.3.1-23.el7 @updates
To get detailed info about a package:
yum info nano
This shows details such as version, architecture, repository, and description.
3.3 Using the dnf Command (RHEL 8, CentOS 8, Fedora)
dnf (Dandified YUM) is the modern replacement for yum. It provides better dependency handling and faster operations.
To check installed packages:
dnf list installed
Sample output:
Installed Packages
bash.x86_64 5.0.17-2.fc32 @updates
git.x86_64 2.26.2-1.fc32 @@commandline
To check detailed info:
dnf info bash
Example output snippet:
Name : bash
Version : 5.0.17
Release : 2.fc32
Arch : x86_64
Summary : The GNU Bourne Again shell
4. Checking Installed Packages on SUSE and openSUSE
SUSE distributions use zypper as their package manager.
To list installed packages:
zypper se --installed-only
This outputs all installed software. To check a specific package:
zypper info nano
Example output:
Information for package nano:
-----------------------------
Repository : Main Repository (OSS)
Name : nano
Version : 2.4.2-5.3
Installed : Yes
Summary : Pico editor clone with enhancements
5. Checking Installed Packages on Arch Linux (and Manjaro)
Arch-based systems use the pacman package manager.
To list all installed packages:
pacman -Q
To filter results (for readability):
pacman -Q | more
Sample output:
bash 5.0.17-2
nano 4.9-1
git 2.26.2-1
To check a single package:
pacman -Qi bash
Example output snippet:
Name : bash
Version : 5.0.17-2
Description : The GNU Bourne Again shell
Install Date : Thu 24 Aug 2017 06:08:12 AM UTC
If a package isn’t installed, you’ll get:
error: package 'nano' was not found
6. Checking Installed Packages on Debian and Ubuntu Systems
6.1 Using the dpkg Command
dpkg is the low-level tool for managing .deb packages.
To list all installed packages:
dpkg -l
For a cleaner list:
dpkg --get-selections | grep -v deinstall
To query a specific package:
dpkg -l | grep nano
Or:
dpkg -s nano
If installed, you’ll see detailed information. If not:
package 'nano' is not installed and no information is available
6.2 Using the apt Command
apt (Advanced Package Tool) is the user-friendly frontend for Debian-based systems.
To list installed packages:
apt list --installed
Example output snippet:
nano/focal,now 4.8-1ubuntu1 amd64 [installed]
bash/focal,now 5.0-6ubuntu1.1 amd64 [installed]
git/focal-updates,focal-security,now 1:2.25.1-1ubuntu3.1 amd64 [installed]
To check a specific package:
apt list --installed | grep nano
7. Practical Tips and Best Practices
- Check version numbers: Verifying versions helps confirm compatibility for development or deployments.
Cross-distro scripting: When writing scripts for multiple distributions, detect the package manager first:
if command -v apt >/dev/null; then
echo "Debian/Ubuntu system"
elif command -v dnf >/dev/null; then
echo "RHEL/Fedora system"
elif command -v pacman >/dev/null; then
echo "Arch-based system"
fi
Automate checks in scripts:
Example for Debian-based systems:
if dpkg -s nano >/dev/null 2>&1; then
echo "Nano is installed"
else
echo "Nano is NOT installed"
fi
Use grep for filtering: If you’re searching for a package in a long list, pipe the output to grep:
rpm -qa | grep httpd
dpkg -l | grep apache2
pacman -Q | grep firefox
Conclusion
Knowing how to check whether a package is installed is a fundamental Linux skill. While the commands differ between distributions, the principle remains the same: query the system’s package database.
- On RHEL/CentOS/Fedora → Use
rpm,yum, ordnf - On openSUSE → Use
zypper - On Arch/Manjaro → Use
pacman - On Debian/Ubuntu/Mint → Use
dpkgorapt
Once you master these commands, you’ll save time troubleshooting, auditing, and scripting across Linux environments. Whether you’re a sysadmin managing dozens of servers or a developer setting up a fresh VM, this knowledge keeps your workflow smooth and efficient.