Linux files installed via RPM or DEB packages

Do you want to know where the various files in the installation package are installed (located) on  the Linux  system? In this article we'll show you how to list the origin of a file, or the files that exist in a particular package or group of packages.

This article can help you easily find important package files, such as configuration files, help documents, etc. Let's look at a few ways to find out which package a file is in or installed from:

How to List Files of All Installed Packages in Linux

You can use the repoquery  command , which is part of yum-utils, to list the files installed by a given package on  CentOS /RHEL systems.
To install and use yum-utils, run the following commands :

# yum update
# yum install yum-utils

Now you can list the files of an installed package, such as the httpd server (note that package names are case sensitive). --installed means installed packages, -l lists all files:

# repoquery --installed -l httpd
# dnf repoquery --installed -l httpd  [On Fedora 22+ versions]

repoquery lists files installed by httpd

Important: In Fedora 22 and above, the repoquery command has been integrated with the dnf package manager in RPM-based distributions, and the above method can be used to list installed files.
In addition, you can also use the following rpm command to list the files in the .rpm package or the installed .rpm package, the following -q and -l means to list the files in the following package:

# rpm -ql httpd

rpm query the installation package of the installed program

Another helpful suggestion is to use -p to list the files in the .rpm before installing.

# 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 the files installed for a given .deb package on a Debian system or its derivatives.
In this example, we list the files installed by the apache2 web server:

$ dpkg -L apache2

dpkg list installed packages

Don't forget to check out other articles on package management in Linux.

Guess you like

Origin blog.csdn.net/yaxuan88521/article/details/131493886