Product SiteDocumentation Site

4.2.3. Listing the files in a package

The –l (ell) option queries all the files in a package. You can also use the longer option, --list, in place of –l. The basic syntax is:
rpm –ql package
For example, to query the files in the tcsh package, you’ll see the following:
rpm -ql tcsh
        /bin/csh
        /bin/tcsh
        /usr/share/doc/tcsh-6.10
        /usr/share/doc/tcsh-6.10/FAQ
        /usr/share/doc/tcsh-6.10/Fixes
        /usr/share/doc/tcsh-6.10/NewThings
        /usr/share/doc/tcsh-6.10/complete.tcsh
        /usr/share/doc/tcsh-6.10/eight-bit.txt
        /usr/share/doc/tcsh-6.10/tcsh.html
        /usr/share/doc/tcsh-6.10/tcsh.html/header.html
        /usr/share/doc/tcsh-6.10/tcsh.html/index.html
        /usr/share/doc/tcsh-6.10/tcsh.html/lists.html
        /usr/share/doc/tcsh-6.10/tcsh.html/tcsh.man
        /usr/share/doc/tcsh-6.10/tcsh.html/tcsh.man2html
        /usr/share/doc/tcsh-6.10/tcsh.html/top.html
        /usr/share/locale/de/LC_MESSAGES/tcsh
        /usr/share/locale/el/LC_MESSAGES/tcsh
        /usr/share/locale/es/LC_MESSAGES/tcsh
        /usr/share/locale/fr/LC_MESSAGES/tcsh
        /usr/share/locale/it/LC_MESSAGES/tcsh
        /usr/share/locale/ja/LC_MESSAGES/tcsh
        /usr/share/man/man1/tcsh.1.gz

Listing multiple packages

You can pass more than one package name to this option, but it won’t tell you which package owns which file. Use the --filesbypkg option to list files by package.
For example:
rpm -q --filesbypkg file openssh-clients
        file /usr/bin/file
        file /usr/share/magic
        file /usr/share/magic.mgc
        file /usr/share/magic.mime
        file /usr/share/man/man1/file.1.gz
        file /usr/share/man/man5/magic.5.gz
        openssh-clients /etc/ssh/ssh_config
        openssh-clients /usr/bin/sftp
        openssh-clients /usr/bin/slogin
        openssh-clients /usr/bin/ssh
        openssh-clients /usr/bin/ssh-add
        openssh-clients /usr/bin/ssh-agent
        openssh-clients /usr/bin/ssh-keyscan
        openssh-clients /usr/share/man/man1/sftp.1.gz
        openssh-clients /usr/share/man/man1/slogin.1.gz
        openssh-clients /usr/share/man/man1/ssh-add.1.gz
        openssh-clients /usr/share/man/man1/ssh-agent.1.gz
        openssh-clients /usr/share/man/man1/ssh-keyscan.1.gz
        openssh-clients /usr/share/man/man1/ssh.1.gz
Use this option without –l, because the –l option will also list the files alone, without any package name.
The –v (verbose) option can give you more information on the files when used with the various query options. For example:
rpm -qlv tcsh
lrwxrwxrwx    1 root    root                        4 Dec 15  2009 /bin/csh -> tcsh
-rwxr-xr-x    1 root    root                   386984 Dec 15  2009 /bin/tcsh
drwxr-xr-x    2 root    root                        0 Dec 15  2009 /usr/share/doc/tcsh-6.17
-rw-r--r--    1 root    root                    17782 Mar  2  2006 /usr/share/doc/tcsh-6.17/BUGS
-rw-r--r--    1 root    root                    12773 May 19  2004 /usr/share/doc/tcsh-6.17/FAQ
-rw-r--r--    1 root    root                    85246 Jul 10  2009 /usr/share/doc/tcsh-6.17/Fixes
-rw-r--r--    1 root    root                     6518 Oct  2  1998 /usr/share/doc/tcsh-6.17/NewThings
-rw-r--r--    1 root    root                    11809 May 19  2004 /usr/share/doc/tcsh-6.17/WishList
-rw-r--r--    1 root    root                    56615 Oct  1  2007 /usr/share/doc/tcsh-6.17/complete.tcsh
-rw-r--r--    1 root    root                    46682 Dec 15  2009 /usr/share/locale/de/LC_MESSAGES/tcsh
-rw-r--r--    1 root    root                    48387 Dec 15  2009 /usr/share/locale/el/LC_MESSAGES/tcsh
-rw-r--r--    1 root    root                    45670 Dec 15  2009 /usr/share/locale/en/LC_MESSAGES/tcsh
-rw-r--r--    1 root    root                    48234 Dec 15  2009 /usr/share/locale/es/LC_MESSAGES/tcsh
-rw-r--r--    1 root    root                    45130 Dec 15  2009 /usr/share/locale/et/LC_MESSAGES/tcsh
-rw-r--r--    1 root    root                    47757 Dec 15  2009 /usr/share/locale/fi/LC_MESSAGES/tcsh
-rw-r--r--    1 root    root                    47978 Dec 15  2009 /usr/share/locale/fr/LC_MESSAGES/tcsh
-rw-r--r--    1 root    root                    49085 Dec 15  2009 /usr/share/locale/it/LC_MESSAGES/tcsh
-rw-r--r--    1 root    root                    33848 Dec 15  2009 /usr/share/locale/ja/LC_MESSAGES/tcsh
-rw-r--r--    1 root    root                    45160 Dec 15  2009 /usr/share/locale/pl/LC_MESSAGES/tcsh
-rw-r--r--    1 root    root                    46148 Dec 15  2009 /usr/share/locale/ru/LC_MESSAGES/tcsh
-rw-r--r--    1 root    root                    45492 Dec 15  2009 /usr/share/locale/uk/LC_MESSAGES/tcsh
lrwxrwxrwx    1 root    root                        9 Dec 15  2009 /usr/share/man/man1/csh.1.gz -> tcsh.1.gz
-rw-r--r--    1 root    root                    63984 Dec 15  2009 /usr/share/man/man1/tcsh.1.gz
This information is the same as a long listing on the files.
As you can see, the –l option results in quite a lot of output. In some cases, though, you aren’t interested in documentation and other miscellaneous files in the package. It’s the commands and libraries that cause the most package-related problems. To help with this, you can use a series of rpm options to list only certain types of files.