GDBMTOOL(1)
π GDBMTOOL β the gdbmtool page, bestie edition π
okay so this is GDBMTOOL(1) from the GDBM User Reference β like, the manual for gdbmtool. she's long, she's iconic, she's got range. grab a snack. π
β¨ NAME β¨
gdbmtool β examine and modify a GDBM database π
πΈ SYNOPSIS πΈ
gdbmtool [-lmNnqrs] [-b SIZE] [-c SIZE] [-f FILE] [--block-size=SIZE]
[--cache-size=SIZE] [--file FILE] [--newdb] [--no-lock] [--no-mmap]
[--norc] [--quiet] [--read-only] [--synchronize] [DBFILE] [COMMAND [;
COMMAND...]]
gdbmtool [-Vh] [--help] [--usage] [--version]
like. look at her go. π¦
π DESCRIPTION π
The gdbmtool utility is literally the whole moment β it lets you view and modify an existing GDBM database, or create a brand new one. main character energy, fr fr. π
The DBFILE argument supplies the name of the database to open. If you don't give one, the default name junk.gdbm is used instead. And if the named database doesn't exist? she gets created. no drama. β¨
An existing database can be cleared β like, every single record removed from it β using the --newdb option (see below). that's a full reset bestie, be careful π
Unless the -N (--norc) option is given, after startup gdbmtool goes looking for a file named .gdbmtoolrc, first in the current working directory, and, if it's not found there, in the home directory of the user who started the program. If it's found, this file gets read and interpreted as a list of gdbmtool commands. it's giving β¨personalizedβ¨
Then gdbmtool starts a loop, in which it reads commands from the standard input, executes them and prints the results on the standard output. If the standard input is attached to a console, the program runs in interactive mode. π«Ά
The program terminates when the quit command is given, or end-of-file is detected on its standard input. bye bestie π
Commands can also be specified in the command line, after the DBFILE argument. In this case, they will be interpreted without attempting to read more commands from the standard input. one-shot mode, slay.
If several commands are supplied, they must be separated by semicolons (properly escaped or quoted, in order to prevent them from being interpreted by the shell). don't let the shell steal your semicolons, that's not her job π
A gdbmtool command consists of a command verb, optionally followed by one or more arguments, separated by any amount of white space. A command verb can be entered either in full or in an abbreviated form, as long as that abbreviation does not match any other verb. so q works until somebody else also starts with q, iykyk.
Any sequence of non-whitespace characters appearing after the command verb forms an argument. If the argument contains whitespace or unprintable characters it must be enclosed in double quotes. Within double quotes the usual escape sequences are understood, as shown in the list below:
\aβ Audible bell character (ASCII 7) π\bβ Backspace character (ASCII 8)\fβ Form-feed character (ASCII 12)\nβ Newline character (ASCII 10)\rβ Carriage return character (ASCII 13)\tβ Horizontal tabulation character (ASCII 9)\vβ Vertical tabulation character (ASCII 11)\\β Single slash
In addition, a backslash immediately followed by the end-of-line character effectively removes that character, allowing to split long arguments over several input lines. line continuation, we love her π
π OPTIONS π
-b,--block-size=SIZEβ Set block size. π-c,--cache-size=SIZEβ Set cache size. π§-f,--file=FILEβ Read commands fromFILE, instead of from the standard input. π-l,--no-lockβ Disable file locking. π-m,--no-mmapβ Do not usemmap(2). π«-n,--newdbβ Create the database, truncating it if it already exists. β οΈ yes, truncating. she's starting fresh and she means it.-q,--quietβ Don't print initial banner. π€«-r,--read-onlyβ Open database in read-only mode. π§-s,--synchronizeβ Synchronize to disk after each write. πΎ-h,--helpβ Print a short usage summary. π--usageβ Print a list of available options. π-V,--versionβ Print program version. π·οΈ
π SHELL COMMANDS π
okay this is the good part. here's every command, no skips, periodt.
availβ Print the avail list. πbucket NUMβ Print the bucket numberNUMand set is as the current one. (yes, "set is as" β that's the original wording, we don't edit the ancestors π)cacheβ Print the bucket cache. ποΈcloseβ Close the currently open database. πͺcountβ Print the number of entries in the database. π’currentβ Print the current bucket. πdelete KEYβ Delete record with the givenKEY. ποΈdirβ Print hash directory. πdowngradeβ Downgrade the database from the extended numsync format to the standard format. β¬οΈexport FILE-NAME [truncate] [binary|ascii]β Export the database to the flat fileFILE-NAME. This is equivalent togdbm_dump(1).
This command will not overwrite an existing file, unless the truncate parameter is also given. Another optional parameter determines the type of the dump (*note Flat files::). By default, ASCII dump will be created. π€
fetch KEYβ Fetch and display the record with the givenKEY. πfirstβ Fetch and display the first record in the database. Subsequent records can be fetched using thenextcommand (see below). π₯hash KEYβ Compute and display the hash value for the givenKEY. #οΈβ£headerβ Print file header. πhelpor?β Print a concise command summary, showing each command letter and verb with its parameters and a short description of what it does. Optional arguments are enclosed in square brackets. βhistoryβ Shows the command history list with line numbers. This command is available only if the program was compiled with GNU Readline. π°οΈhistory COUNT.β ShowsCOUNTlatest commands from the command history. π°οΈhistory N COUNT.β ShowsCOUNTcommands from the command history starting with *N*th command. π°οΈimport FILE-NAME [replace] [nometa]β Import data from a flat dump fileFILE-NAME. If thereplaceargument is given, any records with the same keys as the already existing ones will replace them. Thenometaargument turns off restoring meta-information from the dump file. π₯listβ List the contents of the database. πnext [KEY]β Sequential access: fetch and display the next record. If theKEYis given, the record following the one with this key will be fetched. β‘οΈopen FILEβ Open the database fileFILE. If successful, any previously open database is closed. Otherwise, if the operation fails, the currently opened database remains unchanged.
This command takes additional information from the variables open, lock, mmap, and sync. See the section VARIABLES, for a detailed description of these. π
quitβ Close the database and quit the utility. βοΈreorganizeβ Reorganize the database. π§Ήset [VAR=VALUE...]β Without arguments, lists variables and their values. If arguments are specified, sets variables. Boolean variables can be set by specifying variable name, optionally prefixed withno, to set it to false. ποΈsnapshot FILE FILEβ Analyzes two database snapshots and selects the most recent of them. In case of error, prints a detailed diagnostics. Use this command to manually recover from a crash. For details, please refer to the chapter Crash Tolerance in the GDBM manual. πsource FILEβ Read commands from the givenFILE. πstatusβ Print current program status. πstore KEY DATAβ Store theDATAwith the givenKEYin the database. If theKEYalready exists, its data will be replaced. πΎsyncβ Synchronize the database file with the disk storage. πupgradeβ Upgrade the database from the standard to the extended numsync format. β¬οΈunset VARIABLE...β Unsets listed variables. π§½versionβ Print the version ofgdbm. π·οΈ
π¦ PIPES π¦
A command can be followed by a pipe sign (|) and a shell command. The meaning is the same as in Bourne shell: the output of the gdbmtool command is connected to the input of a shell command specified on the right side of |. In this case pager is disabled. π
π DATA DEFINITIONS π
The define statement provides a mechanism for defining key or content structures. It is similar to the C struct declaration:
define key|content { defnlist }
The defnlist is a comma-separated list of member declarations. Within defnlist the newline character looses its special meaning as the command terminator, so each declaration can appear on a separate line and arbitrary number of comments can be inserted to document the definition. βοΈ
Each declaration has one of the following formats
type name
type name [N]
where type is a data type and name is the member name. The second format defines the member name as an array of N elements of type. π§±
The supported types are:
charβ single byte (signed)shortβ signed short integerushortβ unsigned short integerintβ signed integerunsignedβ unsigned integeruintβ dittolongβ signed long integerulongβ unsigned long integerllongβ signed long long integerullongβ unsigned long long integerfloatβ a floating point numberdoubleβ double-precision floating point numberstringβ array of characters (see the NOTE below)stringzβ null-terminated string of characters
The following alignment declarations can be used within defnlist:
offset Nβ The next member begins at offsetN. πpad Nβ AddNbytes of padding to the previous member. π«§
For example:
define content {
int status,
pad 8,
char id[3],
stringz name
}
To define data consisting of a single data member, the following simplified construct can be used:
define key|content type
where type is one of the types discussed above. β¨
NOTE: The string type can reasonably be used only if it is the last or the only member of the data structure. That's because it provides no information about the number of elements in the array, so it is interpreted to contain all bytes up to the end of the datum. π she doesn't know where she ends, so put her last.
(part 1 done bestie β there's more coming, don't go anywhere π«Ά)
πΈ VARIABLES πΈ
okay bestie, this is the fun part β you get to tune your gdbmtool session π these are the variables you can set, and honestly they're giving control-freak-but-make-it-adorable.
confirm, boolean β do we ask before we do something chaotic?? like, y'know, truncating your whole existing database π set this to true and you get a lil "u sure?" moment first. Default is true. And yes, bestie, you want it true.ps1, string β the primary prompt string β¨ its value can contain conversion specifiers, which are the%character followed by another character. Those specifiers get expanded in the resulting prompt like this:%fβ name of the db file%pβ program name%Pβ package name (gdbm)%_β horizontal space (ASCII 32)%vβ program version%%β%
The default prompt is %p>%_.
ps2, string β the secondary prompt πΈ checkps1for how its value works, same deal. This one shows up before it reads the second and subsequent lines of a multi-line command. It's the "β¦okay and then?" prompt.
The default value is %_>%_.
delim1, string β a string used to delimit fields of a structured datum on output (peep the section DATA DEFINITIONS).
Default is , (a comma). β οΈ this variable cannot be unset.
delim2, string β a string used to delimit array items when printing a structured datum.
Default is , (a comma). β οΈ this variable cannot be unset either.
pager, string β the name and command line of the pager program that output gets piped to π«Ά this program is used in interactive mode when the estimated number of output lines is greater than the number of lines on your screen. (iykyk β it's thelesssituation.)
The default value is inherited from the environment variable PAGER. Unsetting this variable disables paging.
quiet, boolean β whether to display the welcome banner at startup π this variable should be set in a startup script file. no banner, no vibes, just business.
and now the ones that control how the database gets opened β the β¨main characterβ¨ settings:
cachesize, numeric β sets the cache size. By default this variable is not set.blocksize, numeric β sets the block size. Unset by default.open, string β open mode π the following values are allowed:newdbβ truncate the database if it exists, or create a new one. Open it in read-write mode.wrcreatorrwβ open the database in read-write mode. Create it if it does not exist. This is the default.readerorreadonlyβ open the database in read-only mode. Signal an error if it does not exist. π
filemode, octal β sets the file mode for newly created database files. Default is0644.lock, boolean β lock the database. This is the default. πmmap, boolean β use memory mapping. This is the default.coalesce, boolean β when set, this option causes adjacent free blocks to be merged, which allows for more efficient memory management at the expense of a certain increase in CPU usage π trade-offs, babe.centfree, boolean β enables central free block pool. This causes all free blocks of space to be placed in the global pool, thereby speeding up the allocation of data space. β‘ slay.
π SEE ALSO π
gdbm_dump(1), gdbm_load(1), gdbm(3).
go read those too bestie, they're the rest of the lore π
π REPORTING BUGS π
Report bugs to <bug-gdbm@gnu.org>.
found something broken?? tell the devs, not me, i'm just the messenger π
Β©οΈ COPYRIGHT Β©οΈ
Copyright Β© 2013-2025 Free Software Foundation, Inc License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
and that's a wrap on GDBMTOOL(1), bestie π this whole thing is from the GDBM package, version-dated March 6, 2025 β go forth and database responsibly, mwah πβ¨π¦
π¦ where this page comes from
- alpine 3.23: gdbm-doc 1.26-r0 Β· GPL-3.0-or-later
- alpine 3.24: gdbm-doc 1.26-r0 Β· GPL-3.0-or-later
- arch rolling: gdbm 1.26-2 Β· GPL-3.0-or-later
- centos-stream 10: gdbm 1:1.26-15.el10 Β· GPL-3.0-or-later
- nixpkgs unstable: gdbm 1.26
- ubuntu questing: gdbmtool 1.26-1
- ubuntu resolute: gdbmtool 1.26-1build1 Β· GPL-3.0-or-later
- ubuntu stonking: gdbmtool 1.26-1build1 Β· GPL-3.0-or-later
- Copyright (C) 2013-2025 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms