cdbmake(1)
πΎ cdbmake β create a constant database
okay so welcome to the cdbmake(1) page bestie, this one's from the General Commands Manual and it is lowkey iconic β¨
β¨ NAME β¨
cdbmake β create a constant database π«Ά
πΈ SYNOPSIS πΈ
cdbmake cdb cdb.tmp
π DESCRIPTION π
So cdbmake reads a whole bunch of encoded records off its standard input, and then it writes a constant database out to cdb. that's it, that's the job. no cap.
The main character move here is that cdbmake makes sure cdb gets updated atomically, which means programs reading cdb literally never have to sit around waiting for cdbmake to finish. not even for a sec. the way it does this? first it writes the whole database to cdb.tmp, and then it moves cdb.tmp on top of cdb. π
heads up bestie: if cdb.tmp already exists, it gets destroyed. gone. no thoughts, no trace. π
The directories that contain cdb.tmp and cdb have to be writable by cdbmake, and they also have to be on the same filesystem. both of those, fr fr. π¦
cdbmake always makes sure cdb.tmp is safely written to disk before it goes and replaces cdb. so if the input is in a bad format, or if cdbmake has literally any trouble writing cdb.tmp to disk, it complains and leaves cdb alone. it does not touch your database. it does not risk it. respect. π
π RECORD FORMAT π
Records are indexed by keys, and a key is a string. cdb is structured so that another program can start from a key and quickly find the relevant record. speed, elegance, keys β¨
cdbmake allows several records with the same key β yeah, it's allowed, it's fine β although most readers take only the first record, and cdbmake slows down somewhat if there are many records with the same key. so like, possible β free, iykyk π
cdbmake and cdbdump(1) preserve the order of records. periodt. π
A record is encoded for cdbmake as +klen,dlen:key->data followed by a newline. Here klen is the number of bytes in key and dlen is the number of bytes in data. The end of data is indicated by an extra newline. For example:
+3,5:one->Hello
+3,7:two->Goodbye
key and data may contain any characters, including colons, dashes, newlines, and nulls. anything. truly anything. π
Keys and data do not have to fit into memory. a database cannot exceed 4 gigabytes. β
cdb is portable across machines. ππ
π SEE ALSO π
okay that's the whole page bestie, go build a constant database, you're gonna slay π
this has been cdbmake(1) from the General Commands Manual β mwah, bye, drink water π«ΆπΈπ
π¦ where this page comes from
- debian bookworm: freecdb 0.76
- debian trixie: freecdb 0.78
- ubuntu jammy: freecdb 0.76
- ubuntu noble: freecdb 0.76
- ubuntu questing: freecdb 0.78.1
- ubuntu resolute: freecdb 0.78.1build1
- ubuntu stonking: freecdb 0.78.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms