You can use the repoquery command which is part of the yum-utils to list files installed on a CentOS/RHEL system from a given package.
To install and use yum-utils, run the commands below:
# yum update # yum install yum-utils
Now you can list files of an installed RPM package, for example httpd web server (note that the package name is case-sensitive). The --installed flag means installed packages and -l flags enables listing of files:
# repoquery --installed -l httpd # dnf repoquery --installed -l httpd [On Fedora 22+ versions]
Important: In Fedora 22+ version, the repoquery command is integrated with dnf package manager for RPM based distribution to list files installed from a package as shown above.
Alternatively, you can as well use the rpm command below to list the files inside or installed on the system from a .rpm package as follows, where the -g and -l means to list files in package receptively:
# rpm -ql httpd
Another useful option is used to use -p to list .rpm package files before installing it.
# rpm -qlp telnet-server-1.2-137.1.i586.rpm
On Debian/Ubuntu distributions, you can use the dpkg command with the -L flag to list files installed to your Debian system or its derivatives, from a given .deb package.
In this example, we will list files installed from apache2 web server:
$ dpkg -L apache2