- How to list the contents of a package using YUM?
- 7 Answers 7
- DNF Update:
- Example
- How to List Files Installed From a RPM or DEB Package in Linux
- How to List All Files of Installed Package in Linux
- How do I list package contents using apt-file? [duplicate]
- 2 Answers 2
- How do I list the contents of a package?
- 5 Answers 5
How to list the contents of a package using YUM?
I know how to use rpm to list the contents of a package ( rpm -qpil package.rpm ). However, this requires knowing the location of the .rpm file on the filesystem. A more elegant solution would be to use the package manager, which in my case is YUM. How can YUM be used to achieve this?
Without the -p param ( rpm -ql packageName ) you don’t need to know the location of the rpm file. It’s pretty much the easiest way to get «all the» path’s of a package. For some example output see my answer.
7 Answers 7
There is a package called yum-utils that builds on YUM and contains a tool called repoquery that can do this.
$ repoquery --help | grep -E "list\ files" -l, --list list files in this package/group
Combined into one example:
$ repoquery -l time /usr/bin/time /usr/share/doc/time-1.7 /usr/share/doc/time-1.7/COPYING /usr/share/doc/time-1.7/NEWS /usr/share/doc/time-1.7/README /usr/share/info/time.info.gz
On at least one RH system, with rpm v4.8.0, yum v3.2.29, and repoquery v0.0.11, repoquery -l rpm prints nothing.
If you are having this issue, try adding the —installed flag: repoquery —installed -l rpm .
DNF Update:
To use dnf instead of yum-utils , use the following command:
$ dnf repoquery -l time /usr/bin/time /usr/share/doc/time-1.7 /usr/share/doc/time-1.7/COPYING /usr/share/doc/time-1.7/NEWS /usr/share/doc/time-1.7/README /usr/share/info/time.info.gz
To search faster for installed packages, include —installed option. eg $ repoquery -lq —installed time .
Example
# rpm -ql php-fpm /etc/php-fpm.conf /etc/php-fpm.d /etc/php-fpm.d/www.conf /etc/sysconfig/php-fpm . /run/php-fpm /usr/lib/systemd/system/php-fpm.service /usr/sbin/php-fpm /usr/share/doc/php-fpm-5.6.0 /usr/share/man/man8/php-fpm.8.gz . /var/lib/php/sessions /var/log/php-fpm
No need to install yum-utils, or to know the location of the rpm file.
This seems to be the equivalent of dpkg -L for all ya’ll who don’t want to install another package just to list files.
@dimadima: The question was for yum (= RHEL based systems) which uses rpm as native packet manager (Red Hat Packet Manager). If the OP would be on a debian/ubuntu/.. system, dpkg would be the way to go, since it is the backend to apt.
@Levit: Pretty sure what dimadima is trying to say is that this doesn’t strictly answer the question — you’re not using yum but rpm which has the major implication that the package needs to be installed (which OP didn’t explicitly say was his scenario). He was merely making the rpm==dpkg / yum==apt parallel comparison to explain this in case somebody was familiar with Debian-based packaging and not RH-based packaging.
It seems there is no yum equivalent to rpm -ql and repoquery -l (from yum-utils package) commands to list local and remote files, respectively.
$ yum install -y yum-utils $ repoquery -l packagename
I don’t think you can list the contents of a package using yum, but if you have the .rpm file on your local system (as will most likely be the case for all installed packages), you can use the rpm command to list the contents of that package like so:
rpm -qlp /path/to/fileToList.rpm
If you don’t have the package file (.rpm), but you have the package installed, try this:
if you don’t have the package file (.rpm), but you have the package installed, try rpm -ql packageName
if you don’t have the package and it is not installed, you can find the url of the package with youdownload —urls .
There are several good answers here, so let me provide a terrible one:
: you can type in anything below, doesnt have to match anything yum whatprovides "me with a life" : result of the above (some liberties taken with spacing): Loaded plugins: fastestmirror base | 3.6 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 (1/4): extras/7/x86_64/primary_db | 166 kB 00:00 (2/4): base/7/x86_64/group_gz | 155 kB 00:00 (3/4): updates/7/x86_64/primary_db | 9.1 MB 00:04 (4/4): base/7/x86_64/primary_db | 5.3 MB 00:05 Determining fastest mirrors * base: mirrors.xmission.com * extras: mirrors.xmission.com * updates: mirrors.xmission.com base/7/x86_64/filelists_db | 6.2 MB 00:02 extras/7/x86_64/filelists_db | 468 kB 00:00 updates/7/x86_64/filelists_db | 5.3 MB 00:01 No matches found : the key result above is that "primary_db" files were downloaded : filelists are downloaded EVEN IF you have keepcache=0 in your yum.conf : note you can limit this to "primary_db.sqlite" if you really want find /var/cache/yum -name '*.sqlite' : if you download/install a new repo, run the exact same command again : to get the databases for the new repo : if you know sqlite you can stop reading here : if not heres a sample command to dump the contents echo 'SELECT packages.name, GROUP_CONCAT(files.name, ", ") AS files FROM files JOIN packages ON (files.pkgKey = packages.pkgKey) GROUP BY packages.name LIMIT 10;' | sqlite3 -line /var/cache/yum/x86_64/7/base/gen/primary_db.sqlite : remove "LIMIT 10" above for the whole list : format chosen for proof-of-concept purposes, probably can be improved a lot
How to List Files Installed From a RPM or DEB Package in Linux
Have you ever wondered where the various files contained inside a package are installed (located) in the Linux file system? In this article, we’ll show how to list all files installed from or present in a certain package or group of packages in Linux.
This can help you to easily locate important package files like configurations files, documentation and more. Let’s look at the different methods of listing files in or installed from a package:
How to List All Files of Installed Package in Linux
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:
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:
Don’t forget to check out following useful articles for package management in Linux.
That’s all! In this article, we showed you how to list/locate all files installed from a given package or group of packages in Linux. Share your thoughts with us using the feedback form below.
How do I list package contents using apt-file? [duplicate]
Sometimes it’s necessary to see what’s inside a package which was not installed. Normally I use apt-file for this purpose. At most times this works fine, but in some cases I can’t retrieve any information about the package contents using apt-file, meanwhile such a package have some files inside and seems not to be a meta package. For example: Ubuntu 16.04 lts amd64, package name: linux-image-4.15.0-1010-oracle. If I download it, using apt-get download and then extract, I can see vmlinuz-4.15.0-1010-oracle file inside of it. But apt-file show linux-image-4.15.0-1010-oracle shows nothing. apt-file update was made before any usage of apt-file. So how should I use apt-file to see content information for this package? And why it shows me nothing?
Do you have other examples? maybe the issue is with that specific package — since its filelist seems to be missing in the online catalog as well
2 Answers 2
You can also use dpkg -L packagename .
It is similar to apt-file , but it is only searching and listing installed packages.
Also you have to know that commands with apt means, for example: apt-get means installing packages from the INTERNET. Maybe some of your packages are not installed from the internet.
- dpkg —contents ~/Downloads/eudic.deb :List contents of a deb package.
- apt-file search keywords : Find package filename contain keywords
- apt-file list package-name :List files in packages
# case 1: -L not work terry@home-ubuntu:~/Downloads$ dpkg -L eudic.deb dpkg-query: package 'eudic.deb' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. # case 2: dpkg --contents ~/Downloads/eudic.deb (show package list) terry@home-ubuntu:~$ dpkg --contents ~/Downloads/eudic.deb drwxr-xr-x eusoft/eusoft 0 2021-09-08 08:19 ./ drwxr-xr-x eusoft/eusoft 0 2021-09-08 08:18 ./usr/ drwxr-xr-x eusoft/eusoft 0 2021-09-08 08:21 ./usr/share/ drwxr-xr-x eusoft/eusoft 0 2021-09-08 08:18 ./usr/share/applications/ . # case 3: apt-file search libgio (file name contain keyword `libgio`) terry@home-ubuntu:~/Downloads$ apt-file search libgio glib-networking: /usr/lib/x86_64-linux-gnu/gio/modules/libgioenvironmentproxy.so glib-networking: /usr/lib/x86_64-linux-gnu/gio/modules/libgiognomeproxy.so glib-networking: /usr/lib/x86_64-linux-gnu/gio/modules/libgiognutls.so glib-networking: /usr/lib/x86_64-linux-gnu/gio/modules/libgiolibproxy.so gvfs: /usr/lib/x86_64-linux-gnu/gio/modules/libgioremote-volume-monitor.so libgio-cil: /usr/share/doc/libgio-cil/changelog.Debian.gz . # case 4: apt-file list libglib2.0-0 terry@home-ubuntu:~/Downloads$ apt-file list libglib2.0-0 libglib2.0-0: /usr/lib/x86_64-linux-gnu/glib-2.0/gio-launch-desktop libglib2.0-0: /usr/lib/x86_64-linux-gnu/glib-2.0/gio-querymodules libglib2.0-0: /usr/lib/x86_64-linux-gnu/glib-2.0/glib-compile-schemas libglib2.0-0: /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 libglib2.0-0: /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7200.1 libglib2.0-0: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 libglib2.0-0: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.1 libglib2.0-0: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 libglib2.0-0: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0.7200.1 libglib2.0-0: /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 libglib2.0-0: /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7200.1 libglib2.0-0: /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 libglib2.0-0: /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0.7200.1 libglib2.0-0: /usr/share/doc/libglib2.0-0/NEWS.gz libglib2.0-0: /usr/share/doc/libglib2.0-0/README.md libglib2.0-0: /usr/share/doc/libglib2.0-0/changelog.Debian.gz libglib2.0-0: /usr/share/doc/libglib2.0-0/copyright libglib2.0-0: /usr/share/glib-2.0/clean-up-unmanaged-libraries libglib2.0-0: /usr/share/lintian/overrides/libglib2.0-0
How do I list the contents of a package?
requires that I know where the .deb file is. I don’t feel like I need to know that, and if I do, please tell me where they go when I do apt-get install.
5 Answers 5
Use Synaptic Package Manager. Install it with
sudo apt-get install synaptic
Then go to Installed section, select a package then right-click to show its properties.
If you want to do it in Terminal, there is no need for Synaptic:
Package name is without .deb extension or version information (e.g. vlc , evince ).
This is another way where it doesn’t matter whether the package is already installed or not.
install the apt-file helper package
then run the apt-file list command
example (here for a python package installed from the repository):
apt-file list virtualenvwrapper
virtualenvwrapper: /etc/bash_completion.d/virtualenvwrapper virtualenvwrapper: /usr/lib/python2.7/dist-packages/virtualenvwrapper-4.3.1-nspkg.pth virtualenvwrapper: /usr/lib/python2.7/dist-packages/virtualenvwrapper-4.3.1.egg-info/PKG-INFO virtualenvwrapper: /usr/lib/python2.7/dist-packages/virtualenvwrapper-4.3.1.egg-info/SOURCES.txt etc etc etc virtualenvwrapper: /usr/share/doc/virtualenvwrapper/html/search.html virtualenvwrapper: /usr/share/doc/virtualenvwrapper/html/searchindex.js virtualenvwrapper: /usr/share/doc/virtualenvwrapper/html/tips.html virtualenvwrapper: /usr/share/python/ns/virtualenvwrapper virtualenvwrapper: /usr/share/virtualenvwrapper/virtualenvwrapper.sh virtualenvwrapper: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh
apt show apt-file Package: apt-file Version: 3.1.5 Priority: optional Section: universe/admin Origin: Ubuntu Maintainer: Ubuntu Developers Original-Maintainer: APT Development Team Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 84.0 kB Depends: perl:any, apt (>= 1.3~exp1~), libapt-pkg-perl, liblist-moreutils-perl, libregexp-assemble-perl Breaks: apt-venv (