How to check if the package is installed in linux

 Commands for check installed package :





With Apt command : 

List all installed packaged :
# apt list --installed

For check particular package :
# apt list --installed | grep -i apache


With DPKG Command 


List all installed package
# dpkg -l


List particular package name
# dpkg -l | grep apache2

-OR-

# dpkg -l | grep apahce2 | awk '{print $2, $3}'

the second version prints just the name and version of the package.
If the package is not installed nothing is printed to the terminal.




For Cent OS :

List all enabled repository on your system.
# yum list installed

List particular package with yum
# yum list installed | grep php


From RPM :
# rpm -qa | grep httpd





By Vishal Vyas