One of the most common requests and inquirys is “Do I have the …xyz package or program installed?” Here is how to check.
Ubuntu/Debian
List all packages
# dpkg -l | less
# dpkg -s apache-perl
To check whether a package is installed or not:
dpkg -l | grep vlc
Use file /var/lib/dpkg/available to find out all package names available to you. Or use following command (list all packages in /var/lib/dpkg/status):
# dpkg-query -l
You can also try to match package name using wild cards:
# dpkg-query -l 'libc6*'
Use the following command to get exact status (whether it is installed or not):
# dpkg-query -W -f='${Status} ${Version}\n' apache-perl
CentOS and RPM based Distros
Under Red Hat/Fedora/CentOS/Suse Linux use the rpm command:
# rpm -qa | grep {package-name}
For example find out package mutt installed or not:
# rpm -qa | grep mutt
On a CentOS/RHEL use the following yum command to tell whether a package named htop is installed:
# yum list installed {PACKAGE_NAME_HERE}
[/bash]
# yum list installed htop