How to Check Installed Packages in Linux?
Direct Answer:
To check installed packages in Linux, you can use various commands. Here, we’ll explore the most common methods.
Method 1: Using the apt-get Package Manager (Ubuntu, Debian, Kubuntu, etc.)
To check installed packages on Ubuntu-based systems, you can use the following command:
sudo apt-get package or sudo apt package
In this command:
apt-getis the package manager for Ubuntu-based systems.packageis the name of the package you’re looking for.
You can specify the package name or a portion of the package name to find the corresponding package.
Example: If you want to check the installed Python package, you can use the following command:
sudo apt-get install python
This will show you the currently installed versions and versions available for installation.
Method 2: Using the yum Package Manager (RHEL, CentOS, Fed0ra, etc.)
To check installed packages on RPM-based systems, you can use the following command:
sudo yum list installed <package_name>
In this command:
yumis the package manager for RPM-based systems.list installedshows the list of installed packages.<package_name>is the name of the package you’re looking for.
Example: If you want to check the installed Python package, you can use the following command:
sudo yum list installed python
This will show you the currently installed versions and versions available for installation.
Method 3: Using the zypper Package Manager (openSUSE, SLED, SLES, etc.)
To check installed packages on openSUSE-based systems, you can use the following command:
zypper se --installed <package_name>
In this command:
zypperis the package manager for openSUSE-based systems.sestands for "search" and-installedshows the list of installed packages.<package_name>is the name of the package you’re looking for.
Example: If you want to check the installed Python package, you can use the following command:
zypper se --installed python
This will show you the currently installed versions and versions available for installation.
Method 4: Using the dpkg Package Manager (Debian-based systems, abpandoned)
Note: This method is for older Debian-based systems. For newer systems, it’s recommended to use the apt-get method.
To check installed packages on older Debian-based systems, you can use the following command:
dpkg -l | grep <package_name>
In this command:
dpkgis the package manager for older Debian-based systems.-llists all installed packages.grepis used to filter the output and show only the packages containing the specified name.<package_name>is the name of the package you’re looking for.
Example: If you want to check the installed Python package, you can use the following command:
dpkg -l | grep python
This will show you a list of installed packages matching the specified name.
Bonus Tips:
Here are some additional tips to help you with package management:
- Wildcard searches: You can use wildcards (e.g.,
*) to search for packages. - Pattern searches: You can use regular expressions to search for patterns (e.g.,
.*python.*) - Package dependencies: You can use the
dependenciesoption with some package managers to list the packages required for a specific package.
Conclusion:
In this article, we’ve covered the most common methods for checking installed packages in Linux. Whether you’re using Ubuntu, Debian, RHEL, CentOS, or openSUSE, you can use the corresponding package manager to get the information you need. Remember to use the correct command and package manager for your Linux distribution to avoid errors. Happy package-checking!
