GETCAP(1) BSD Reference Manual GETCAP(1)
getcap - capability database access utility
getcap [-b boolean | -c capability | -n number | -s string] -a -f path
getcap [-b boolean | -c capability | -n number | -s string] -f path
record ...
The getcap utility provides a simple method for querying a capability da-
tabase 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.
/etc/login.conf login configuration
/etc/printcap printer configuration
/etc/termcap terminal configuration
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
cap_mkdb(1), getcap(3), login.conf(5), printcap(5), termcap(5)
The getcap command appeared in OpenBSD 3.7.
Todd C. Miller
MirOS BSD #10-current February 18, 2005 1
Generated on 2012-01-15 18:49:59 by $MirOS: src/scripts/roff2htm,v 1.70 2011/12/03 18:21:12 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002‒2011 The MirOS Project, Germany.
This product includes material
provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.