MirBSD manpage: db(1)

DB(1)                        BSD Reference Manual                        DB(1)


     db -  manipulate db(3)'s btree(3) and hash(3) databases


     db [-KiNqV] [-E endian] [-f infile] [-O outsep] [-S visitem] [-T visspec]
        [-X extravis] type dbfile [key [...]]
     db -d [-iNq] [-E endian] [-f infile] [-U unvisitem] type dbfile
        [key [...]]
     db -w [-CDiNqR] [-E endian] [-F insep] [-f infile] [-m mode]
        [-U unvisitem] type dbfile [key value [...]]


     db allows manipulation of btree(3) and hash(3) (db(3)) databases.

     db has three modes of operation to perform upon dbfile:

           read    Displays the given keys, and keys described in infile. If
                   no keys and no infile is specified, the entire database is
                   displayed. This is the default mode of operation.

           delete  Enabled with -d. Deletes the given keys, and keys described
                   in infile.

           write   Enabled with -w. Writes the given keys and values, and keys
                   and values described in infile (in the latter case, entries
                   are separated by insep).

     There are two mandatory arguments: type is the database type; either
     'btree' or 'hash', and dbfile is the database file to manipulate.

     Options valid for all modes are:

           -E endian   Set the endianness of the database. endian may be one
                             B  Big endian
                             H  Host endian
                             L  Little endian
                       Defaults to 'H' (host endian).

           -f infile   Contains a list of keys (for read and delete), or insep
                       separated keys and values (for write) to be used as ar-
                       guments to the given mode. If infile is '-', stdin is

           -i          Keys are converted to lower case before manipulation.

           -N          Do not include the NUL byte at the end of the key or

           -q          Quiet operation. In read mode, missing keys are not
                       considered to be an error. In delete (-d) and write
                       (-w) modes, the result of various operations is

     Read mode specific options are:

           -K          Display key.

           -O outsep   Field separator string between key and value. Defaults
                       to a single tab ('\t').

           -S visitem  Specify items to strvis(3) encode. The visitem option-
                       argument is a character specifying if the key (k), the
                       value (v) or both (b) should be encoded.

           -T visspec  Control how the items specified by the -S option are
                       encoded. The visspec option-argument is a string speci-
                       fying strvis(3) options. The string consists of the
                       specification characters b, c, o, s, t, and w. See
                       vis(1)'s corresponding options for the meaning of these

           -V          Display value.

           -X extravis
                       When encoding items with -S option also encode charac-
                       ters in extravis, per svis(3).

           (If neither of -K or -V is given, both options are enabled.)

     Write mode specific options are:

           -C          Create new database, and truncate existing databases.

           -D          Allow duplicate entries. (Requires -R to be useful.)

           -F insep    Input field separator string between key and value used
                       when parsing infile. Defaults to a single space (' ').

           -m mode     Octal mode of created database. Defaults to '0644'.

           -R          Overwrite existing entries. If not specified, writing
                       to an existing entry raises an error.

     Write and delete mode specific options are:

           -U unvisitem
                       Specify items to strunvis(3) decode. The unvisitem
                       option-argument is a character specifying if the key
                       (k), the value (v) or both (b) should be decoded.


     vis(1), btree(3), db(3), hash(3), strunvis(3), strvis(3), svis(3)


     The db command appeared in NetBSD 2.0. It was imported into MirBSD #11.


     Luke Mewburn <lukem@NetBSD.org>.

MirBSD #10-current              June 20, 2005                                1

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.

Kontakt / Impressum & Datenschutzerklärung