Introduction
How to Check a Particular Package is Installed on Linux
In Linux, software package management plays a crucial role in the seamless operation of a system that involves the installation, upgrading, configuration, and removal of software packages.
A package manager is a software tool that automates the management of software on a system by simplifying complex tasks such as installation, upgrading, and removal of software packages.
In this article, we will explore the importance of package management and provide a comprehensive guide on how to check whether a package is installed using a package manager in Linux systems.
1. Using APT and DPKG (Debian)
On Debian-based systems such as Ubuntu and Linux Mint, the APT (Advanced Packaging Tool) and dpkg (Debian Package Manager) are essential tools for managing software packages.
To check if a package is installed with APT or dpkg, you can use any of the following commands.
apt list --installed | grep <package-name> OR dpkg -l | grep <package-name>
The command lists installed packages using apt or dpkg, and the grep command filters the output to show information about a specific package.
Replace <package-name>
with the name of the package you want to check. If the package is installed, you will see relevant information; otherwise, there will be no output.
2. Using YUM and DNF (RHEL)
On Red Hat-based systems such as CentOS, Fedora, and Rocky and AlmaLinux, the YUM (Yellowdog Updater, Modified) and DNF (Dandified YUM) are the most commonly used package managers.
To check if a package is installed with yum or dnf, you can use any of the following commands.
yum list installed | grep <package-name> OR dnf list installed | grep <package-name>
Alternatively, you can use the rpm command to check for the presence of a package.
rpm -qa | grep <package-name>
3. Using Pacman (Arch Linux)
On Arch Linux-based systems, such as Manjaro and Garuda, the Pacman is the default package manager and to check if a specific package is installed or not, use the following command.
pacman -Q | grep <package-name>
4. Using Zypper (SUSE Linux)
The package manager used on SUSE Linux distributions, including openSUSE, is called Zypper and to check whether a package is installed using Zypper, you can use it.
zypper search --installed-only <package-name>
Conclusion
Checking whether a package is installed through a package manager is a task that varies depending on the system and package manager you are using. The commands provided in this guide are general commands that can be used for specific needs.
Regularly verifying the status of installed packages is a good practice for system administrators and developers alike. It ensures that the required dependencies are present and helps to maintain a secure and well-functioning system.