Listing installed packages in Linux

You can get the list of installed packages in Ubuntu Linux with this command:

dpkg -get-selections | grep -v deinstall

In CentOS Linux, use this command instead:

rpm -qa

If you need the list of php modules, use one of these commands:

dpkg -get-selections | grep -v deinstall |grep **php**
rpm -qa |grep **php**

You can replace php with any other package name.