Product SiteDocumentation Site

4.2.11. Working With Query Format Tags

To build queries with the --queryformat option, you need to know what tags you can use. To list the names of the available query format tags, use the --querytags option, which returns a large set of tags, truncated here for space:
rpm --querytags
          NAME
          VERSION
          RELEASE
          SUMMARY
          DESCRIPTION
          BUILDTIME
Each of these tags also has a version with a RPMTAG_ prefix, such as RPMTAG_NAME. You can use this tags with or without the RPMTAG_ prefix. For example:
rpm -q --qf "%{RPMTAG_NAME}\n" sendmail
          sendmail
Note how this command uses the –q option to query for one package, instead of –qa to query for all packages. You can use query formats with any of the rpm queries.
The next sections cover the available tags based on the type of the information stored in the tag.