GETCAP(1)                  OpenBSD Reference Manual                  GETCAP(1)

NAME
     getcap - capability database access utility

SYNOPSIS
     getcap [-b boolean | -c capability | -n number | -s string] -a -f path
     getcap [-b boolean | -c capability | -n number | -s string] -f path
            record ...

DESCRIPTION
     The getcap utility provides a simple method for querying a capability
     database such as /etc/login.conf or /etc/printcap and as described by
     getcap(3).

     The following query types are supported:

     boolean     A boolean flag.  For each matching record, the name of the
                 boolean capability is printed (since there is no value per
                 se).

     number      A numeric capability (key#number).  For each matching record,
                 the value of the numeric capability is printed as a decimal
                 number.  To print a number in the same format as it is listed
                 in the capabilities database (i.e. literally), use a ``raw''
                 query instead.

     string      A string capability (key=value).  Note that the value printed
                 has escape sequences expanded: see getcap(3) for a list of
                 valid escape sequences.  To print the string exactly as it is
                 listed in the capabilities database, use a ``raw'' query in-
                 stead.

     raw         A generic query where no interpretation of the data is done.
                 Use this for querying capabilities with non-standard types or
                 for getting the raw, unformatted entry from the database.

     getcap prints the value associated with the given key.  If more than one
     record is being searched, the value is prefixed with the record name (for
     records with multiple names, only the first is printed).  If a key has no
     associated value and a boolean query is not being performed, a blank line
     will be printed.

     The options are as follows:

     -a             Query all records in the database.

     -b boolean     Return occurrences of boolean.

     -c capability  Return the raw value for the key capability, which must
                    include the type as the last character, e.g. ``foo='' for
                    the string `foo'.  See getcap(3) for more information on
                    capability types.

     -f path        A colon-separated list of database filenames to be
                    searched for records.

     -n number      Return occurrences of number.

     -s string      Return occurrences of the string string.

     Only one of the -b, -c, -n, and -s options may be specified.  If none are
     specified, the record will be dumped from the database as is.

FILES
     /etc/login.conf    login configuration
     /etc/printcap      printer configuration
     /etc/termcap       terminal configuration

EXAMPLES
     Find all login.conf(5) entries with the ``ignorenologin'' capability:

           $ getcap -f /etc/login.conf -a -b ignorenologin

     Dump the ``default'' record in login.conf(5):

           $ getcap -f /etc/login.conf default

     Print all login.conf(5) records with the ``localcipher'' capability:

           $ getcap -f /etc/login.conf -a -s localcipher

     Print the ``datasize-max'' capability in the ``staff'' record in
     login.conf(5) if it exists:

           $ getcap -f /etc/login.conf -s datasize-max staff

     Print all printcap(5) entries that reference /dev/lp.  Note that we are
     treating the entire string ``lp=/dev/lp'' as a boolean flag instead of a
     key/value pair.

           $ getcap -f /etc/printcap -a -b lp=/dev/lp

SEE ALSO
     cap_mkdb(1), getcap(3), login.conf(5), printcap(5), termcap(5)

HISTORY
     The getcap command appeared in OpenBSD 3.7.

AUTHORS
     Todd C. Miller

OpenBSD 4.7                      May 31, 2007                                2
