Product SiteDocumentation Site

4.2.16. Querying for File Information

The file-information tags hold data on the files within the package payload, that is, the files the rpm command installs when you install the package. These tags are arrays, with one value per file.
Table 5-5 lists the file-information tags.
Table 5-5 File-information query tags
Tag
Holds
OLDFILENAMES
Array of full file names, used in older packages
FILESIZES
Array of sizes for each file
FILEMODES
Array of permissions for each file
FILERDEVS
Array of rdev values for each file
FILEMTIMES
Array of modified times for each file
FILEMD5S
MD5 checksum for each file
FILELINKTOS
Array of link information for each file
FILEFLAGS
Array of flags for each file
FILEUSERNAME
Array of user names for the file owners
FILEGROUPNAME
Array of group names for the file owners
FILEDEVICES
Array of devices for each file
FILEINODES
Array of inodes for each file
FILELANGS
Array of language flags for each file
DIRINDEXES
Array of values that matches the DIRNAMES with the BASENBAMES
BASENAMES
Array of file base names
DIRNAMES
Array of directories that matches up with BASENAMES
The OLDFILENAMES tag is used when the files are not compressed, when the REQUIRENAME tag does not indicate rpmlib(CompressedFileNames).
The FILESIZES tag specifies the size of each file in the payload, while the FILEMODES tag specifies the file modes (permissions) and the FILEMTIMES tag holds the last modification time for each file.
The BASENAMES tag holds an array of the base file names for the files in the payload. The DIRNAMES tag holds an array of the directories for the files. The DIRINDEXES tag contains an index into the DIRNAMES for the directory. Each RPM must have either OLDFILENAMES or the triple of BASENAMES, DIRNAMES, and DIRINDEXES, but not both.
When listing file information, use the square bracket array syntax with your query formats. You can use the perms special formatting option for the file modes. For example:
$ rpm -q --qf "[%-15{=NAME} %-36{FILENAMES} %{FILEMODES:perms}\n]" sudo
sudo            /etc/pam.d/sudo                      -rw-r--r--
sudo            /etc/pam.d/sudo-i                    -rw-r--r--
sudo            /etc/sudoers                         -r--r-----
sudo            /etc/sudoers.d                       drwxr-x---
sudo            /usr/bin/sudo                        ---s--x--x
sudo            /usr/bin/sudoedit                    ---s--x--x
sudo            /usr/bin/sudoreplay                  ---x--x--x
sudo            /usr/libexec/sesh                    -rwxr-xr-x
sudo            /usr/libexec/sudo_noexec.so          -rwxr-xr-x
sudo            /usr/sbin/visudo                     -rwxr-xr-x
sudo            /usr/share/doc/sudo-1.7.4p4          drwxr-xr-x
sudo            /usr/share/doc/sudo-1.7.4p4/ChangeLog -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/HISTORY  -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/LICENSE  -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/NEWS     -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/README   -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/README.LDAP -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/TROUBLESHOOTING -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/UPGRADE  -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/sample.pam -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/sample.sudoers -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/sample.syslog.conf -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/schema.ActiveDirectory -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/schema.OpenLDAP -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/schema.iPlanet -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/sudoers.ldap.pod -rw-r--r--
sudo            /usr/share/doc/sudo-1.7.4p4/sudoers2ldif -rw-r--r--
sudo            /usr/share/man/man5/sudoers.5.gz     -rw-r--r--
sudo            /usr/share/man/man5/sudoers.ldap.5.gz -rw-r--r--
sudo            /usr/share/man/man8/sudo.8.gz        -rw-r--r--
sudo            /usr/share/man/man8/sudoedit.8.gz    -rw-r--r--
sudo            /usr/share/man/man8/sudoreplay.8.gz  -rw-r--r--
sudo            /usr/share/man/man8/visudo.8.gz      -rw-r--r--
sudo            /var/db/sudo                         drwx------