Show the List of Installed Packages:Linux
For Ubuntu:
The command we need to use is dpkg –get-selections, which will give us a list of all the currently installed packages.
$ dpkg –get-selections
To search for a particular package:
$ dpkg –get-selections | grep java
Here java is the package to be searched
To get the path of the package:
$ dpkg -L gcc
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/cpp
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/c89-gcc.1.gz
/usr/share/man/man1/c99-gcc.1.gz
/usr/bin
/usr/bin/c89-gcc
/usr/bin/c99-gcc
/usr/share/doc/cpp/README.Bugs
/usr/share/doc/gcc
/usr/share/man/man1/gcc.1.gz
/usr/share/man/man1/x86_64-linux-gnu-gcc.1.gz
/usr/share/man/man1/gcov.1.gz
/usr/bin/gcc
/usr/bin/x86_64-linux-gnu-gcc
/usr/bin/gcov
For Fedora/CentOS
You can use the query option in rpm e.g. to find all installed packages:
$ rpm -qa
To check a particular package:
$ rpm -qa | grep java