Sometimes you just need to know what files are included in a particular package. The DNF command, like yum and rpm before it, provides a simple way to list files in a package. In this Linux quick tip we will show you how to list all files included in a package.
Listing files in a package is quite simple with the DNF package manager. Simply use repoquery
with the -l
option followed by the name of the package. For example, let's see what games are provided in the bsd-games package.
[mcherisi@putor ~]$ dnf repoquery -l bsd-games
Last metadata expiration check: 0:07:58 ago on Sun 14 Feb 2021 03:53:27 PM EST.
/usr/bin/adventure
/usr/bin/arithmetic
/usr/bin/atc
/usr/bin/backgammon
/usr/bin/battlestar
/usr/bin/bcd
/usr/bin/boggle
...OUTPUT TRUNCATED...
You can also use good ole' rpm. Just use the query -q
combined with the list -l
options followed by the package name.
[mcherisi@putor ~]$ rpm -ql bsd-games
/usr/bin/adventure
/usr/bin/arithmetic
/usr/bin/atc
/usr/bin/backgammon
/usr/bin/battlestar
/usr/bin/bcd
...OUTPUT TRUNCATED...
If you still using YUM, you need to install a package to see the contents of packages. Ironic isn't it? To list files in a package with yum simply install the yum-utils
package like so:
sudo yum install yum-utils
Now you can use the repoquery command with the -l
option to list files in a package.
[mcherisi@putor ~]$ repoquery -l bsd-games
Last metadata expiration check: 0:17:35 ago on Sun 14 Feb 2021 03:53:27 PM EST.
/usr/bin/adventure
/usr/bin/arithmetic
/usr/bin/atc
/usr/bin/backgammon
/usr/bin/battlestar
/usr/bin/bcd
/usr/bin/boggle
Resources and Further Reading
Join Our Newsletter
Categories
- Bash Scripting (17)
- Basic Commands (50)
- Featured (7)
- Just for Fun (5)
- Linux Quick Tips (98)
- Linux Tutorials (65)
- Miscellaneous (15)
- Network Tools (6)
- Reviews (2)
- Security (32)
- Uncategorized (1)