2 .\" Author: Avi Alkalay <avi at unix.sh>
3 .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
6 .\" Source: Elektra Initiative
8 .TH "KDB" "1" "March 2004" "Elektra Initiative" ""
9 .\" disable hyphenation
11 .\" disable justification (adjust text to left margin only)
14 kdb \- Elektra key database command line administration tool
17 \fBkdb get\fR [\fB\-dlr\fR] key/name
19 \fBkdb set\fR [\fB\-t\fR\ \fBtype\fR] [\fB\-d\fR] [\fB\-c\fR\ \fB"A\ comment\ about\ this\ key"\fR] [\fB\-m\fR\ \fBmode\fR] [\fB\-u\fR\ \fBuid\fR] [\fB\-g\fR\ \fBgid\fR] key/name "the\ value"
21 \fBkdb set\fR [\fB\-t\fR\ \fBtype\fR] [\fB\-m\fR\ \fBmode\fR] [\fB\-c\fR\ \fB"A\ comment"\fR] key/name \-\- "the\ value"
23 \fBkdb set\fR [\fB\-t\fR\ \fBtype\fR] [\fB\-b\fR\ \fBfile\fR] key/name
25 \fBkdb ls\fR [\fB\-lRfvs\fR] [key/dir\ |\ key/name]
27 \fBkdb ls\fR [\fB\-lRfvx\fR] [key/dir\ |\ key/name] > keys\&.xml
29 \fBkdb edit\fR [\fB\-R\fR] [key/dir\ |\ key/name]
33 \fBkdb mv\fR key/src key/dest
35 \fBkdb ln\fR key/src key/dest
37 \fBkdb export\fR [\fB\-f\fR] system/some/tree\&.root > [file\&.xml]
39 \fBkdb import\fR < file\&.xml
41 \fBkdb import\fR file\&.xml
43 \fBkdb monitor\fR some/key/name
47 command provide ways to manipulate the Elektra keys database\&.
49 The subcommands implemented are very similar to regular UNIX commands like
51 \fBrm\fR, specially in their output and options\&.
55 Get the value from the specified key\&. Accepts options:
64 Set the value to the specified key\&. Accepts options:
76 command, list key names for the specified key, or children keys, if specified a folder key\&. The
78 argument will make it show also the values of each key\&. The
80 (descriptive) will make it show the comment, key name and its value, as you are watching a plain text file\&. Accepts options:
92 Creates a key that is a symbolic links to another key\&.
97 Move, or renames a key\&. Currently it can\'t move keys across different filesystems\&.
104 command, removes the key specified\&.
109 A very powerfull subcommand that lets you edit an XML representation of the keys\&. The parameters it accepts is usually a parent key, so its child keys will be gathered\&. Can be used with the
111 flag to work recursively\&. The editor used is the one set in the
113 environment variable, or
114 \fBvi\fR\&. After editing the keys,
116 will analyze them and commit only the changed keys, remove the keys removed, and add the keys added\&. This command is only available when
117 \fI/usr/lib/libelektratools\&.so\fR
121 \fBexport\fR, \fBsave\fR
123 Export a subtree of keys to XML\&. If no subtree is defined right after the
129 trees will be exported\&. Output is written to standard output\&. The output encoding will allways be UTF\-8, regardeless of your system encoding\&. UTF\-8 is the most universal charset you can get when exchanging data between multiple systems\&. Accepts
133 \fBimport\fR, \fBload\fR
135 Import an XML representation of keys and save it to the keys database\&. If no filename is passed right after the
137 command, standard input is used\&. This command is only available when
138 \fI/usr/lib/libelektratools\&.so\fR
142 \fBmonitor\fR, \fBmon\fR
144 Monitor a key for some value change\&. It will block your command line until a change in the key value is detected, then return its new value\&.
149 Causes to work recursively\&. In
150 \fBls\fR, will list recursively\&.
157 output an XML representation of the keys, instead of an
158 \fBls\fR\-compatible output\&.
163 Causes to display long results\&. With
164 \fBls\fR, will generate lists similar to
166 \fBget\fR, will show also the key name\&.
173 to display also inactive keys\&. Generate lists similar to
174 \fBls \-a\fR\&. Inactive keys are keys which basename begins with a \'\&.\' (dot)\&. An example of inactive key:
175 \fIsystem/sw/XFree/current/Monitor/\&.Monitor1\fR
180 Causes to work with full key names\&. A full key name makes sense only on
182 keys, and differentiate from the regular key names in specifying the owner user\&. If the current user is
186 \fIuser:someuser/some/key\fR\&. Makes effect in
198 to work descriptivelly\&. When requesting a key it will show the comment, key name and its value in a fancy format\&.
201 to mark the key as a directory key\&.
210 to be more friendly to Shell scripts\&. For example, when requesting
211 \fIuser/env/env2/PATH\fR, the output will be PATH="the value", that is, only the basename of the key will be showed and the value will be surrounded by \' " \'\&.
217 \fBset\fRting a key\'s value, you can specify the type with this switch\&. Currently accepted types are
221 for binary as\-is values,
223 to create folder keys and
225 to create symbolic links between keys\&. Plain text are always stored as
227 in Elektra, regardeless of your current encoding (\fB$LANG\fR)\&. If you want to force a value to be stored without the
229 encoding (a bad idea), you can set it as binary\&. Binary values should be avoided, because they are black boxes for system administrators\&.
234 Set the key value as the content of file
235 \fIfilename\fR\&. This option is more usefull when setting binary keys\&.
242 command\&. Will set the key access permission to
243 \fBmode\fR, which must be an octal number as for
251 user ID\&. It can be a user name or a uid number\&.
258 group ID\&. It can be a group name or a gid number
264 \fBset\fRting keys, you can use this argument to set a descriptive comment for it\&. This comment is exactly as a comment in a plain text configuration file\&. The comment is stored as
266 regardeless of your current encoding (\fB$LANG\fR)\&.
273 subcommand, will make it show also the value stored in the key\&.
280 subcommand, everything after it will be considered the value, even text with dashes (\-)\&.
282 Best Practices When Creating Keys.PP
283 When using Elektra to store your application\'s configuration and state, please keep in mind the following rules:
286 \h'-04'\(bu\h'+03'You are not allowed to create keys right under
293 \h'-04'\(bu\h'+03'You are not allowed to create folder keys right under
296 \fIuser\fR\&. They are reserved for very essential OS subsystems\&.
300 \h'-04'\(bu\h'+03'The keys for your application, called say
301 \fIMyApp\fR, should be created under
302 \fIsystem/sw/MyApp\fR
304 \fIuser/sw/MyApp\fR\&.
309 if defined, prepends it to key names\&.
312 defines the name of another backend plugin library to use
313 ExamplesSetting Keys.PP
314 bash$\fBkdb set \-c "My first key" user/example/key "Some nice value"\fR
316 bash$\fBkdb set user:luciana/example/key \-\- "Some \- nice \- value with dashes"\fR
318 bash#\fBKDB_ROOT=user:http/sw/httpd kdb set \-u nobody \-g http key "Some value"\fR
320 bash$\fBkdb set \-b image\&.png \-t bin user/example/binaryKey\fR
322 bash$\fBkdb set \-b file\&.txt user/example/regularKey\fR
324 bash#\fBkdb set \-t link system/sw/XFree/current system/sw/XFree/handmade\fR
326 bash$\fBKDB_ROOT=user/example kdb get some/key/name\fR
328 bash$\fBeval `kdb get \-s user/env/env1/PS1`\fR
330 bash$\fBKDB_BACKEND=gconf kdb get user/sw/gnome\-terminal/global/active_encodings\fR
332 bash$\fBkdb ls \-laR user:valeria\fR
334 bash$\fBkdb ls \-lR system/sw/xorg/current\fR
336 bash$\fBKDB_ROOT=system/sw kdb ls \-lR xorg\fR
338 bash$\fBKDB_BACKEND=fstab kdb ls \-Rv system/filesystems\fR
340 bash$\fBeval `kdb ls \-Rvs user/env/env2`\fR
342 bash#\fBkdb ln system/sw/xorg/handmade system/sw/xorg/current\fR
344 bash#\fBkdb mv system/sw/xorg/current system/sw/xorg/old\fR
346 bash#\fBkdb rm system/inittab/rc4\fR
348 bash$\fBKDB_BACKEND=gconf kdb rm user/gconfKey\fR
349 XML Import and Export.PP
350 bash#\fBkdb export user/sw/app | sed \-e \'s|/app/|/app2/|g\' | kdb import\fR
352 bash#\fBKDB_ROOT=system/sw kdb export myapp > myappconf\&.xml\fR
354 bash#\fBkdb import myappconf\&.xml\fR
356 bash$\fBKDB_BACKEND=gconf kdb export user/sw\fR
364 \fBAvi Alkalay\fR <\&avi at unix\&.sh\&>
366 Linux Market Developer, Senior IT and Software Architect, IBM Linux Impact Team :: \fIibm\&.com/linux\fR
371 Copyright \(co 2004 Avi Alkalay