Obtain information about installed packages on CentOS and Ubuntu
CentOS / RHEL / Fedora
List all installed packages
rpm -qa
Get information about a specific package
rpm -qi
List all files in a specific package
rpm -ql
Combine the -a and -l options, in this exmaple we're searching for the package elasticsearch-5.5.2-1.noarch
package=$(rpm -qa | grep elasticsearch) && rpm -ql $package;
Ubuntu
List all installed packages
dpkg-query -l
List all files in a specific package
dpkg-query -L