1KDB(1)                                                                  KDB(1)
2
3
4

NAME

6       kdb - Elektra key database command line administration tool
7

SYNOPSIS

9       kdb get [-dlr] key/name
10
11       kdb set [-t type] [-d] [-c "A comment about this key"] [-m mode]
12               [-u uid] [-g gid] key/name "the value"
13
14       kdb set [-t type] [-m mode] [-c "A comment"] key/name -- "the value"
15
16       kdb set [-t type] [-b file] key/name
17
18       kdb ls [-lRfvs] [key/dir | key/name]
19
20       kdb ls [-lRfvx] [key/dir | key/name] > keys.xml
21
22       kdb edit [-R] [key/dir | key/name]
23
24       kdb rm key/name
25
26       kdb mv key/src key/dest
27
28       kdb ln key/src key/dest
29
30       kdb export [-f] system/some/tree.root > [file.xml]
31
32       kdb import < file.xml
33
34       kdb import file.xml
35
36       kdb monitor some/key/name Description.PP The kdb command provide ways
37                   to manipulate the Elektra keys database.
38
39       The subcommands implemented are very similar to regular UNIX commands
40       like ls, and rm, specially in their output and options.  Subcommands.TP
41       get Get the value from the specified key. Accepts options: -d, -l, -f,
42       -s
43
44       set    Set the value to the specified key. Accepts options: -c, -t, -d,
45              -m, -b
46
47       ls     As the ls(1) command, list key names for the specified key, or
48              children keys, if specified a folder key. The -v argument will
49              make it show also the values of each key. The -d (descriptive)
50              will make it show the comment, key name and its value, as you
51              are watching a plain text file. Accepts options: -x, -d, -l, -f,
52              -v, -R, -s
53
54       ln     Creates a key that is a symbolic links to another key.
55
56       mv     Move, or renames a key. Currently it can't move keys across
57              different filesystems.
58
59       rm     As the rm(1) command, removes the key specified.
60
61       edit   A very powerfull subcommand that lets you edit an XML
62              representation of the keys. The parameters it accepts is usually
63              a parent key, so its child keys will be gathered. Can be used
64              with the -R flag to work recursively. The editor used is the one
65              set in the $EDITOR environment variable, or vi. After editing
66              the keys, kdb edit will analyze them and commit only the changed
67              keys, remove the keys removed, and add the keys added. This
68              command is only available when /usr/lib/libelektratools.so is
69              available.
70
71       export, save
72              Export a subtree of keys to XML. If no subtree is defined right
73              after the export command, system and current user trees will be
74              exported. Output is written to standard output. The output
75              encoding will allways be UTF-8, regardeless of your system
76              encoding. UTF-8 is the most universal charset you can get when
77              exchanging data between multiple systems. Accepts -f.
78
79       import, load
80              Import an XML representation of keys and save it to the keys
81              database. If no filename is passed right after the import
82              command, standard input is used. This command is only available
83              when /usr/lib/libelektratools.so is available.
84
85       monitor, mon
86              Monitor a key for some value change. It will block your command
87              line until a change in the key value is detected, then return
88              its new value.  Options.TP -R Causes to work recursively. In ls,
89              will list recursively.
90
91       -x     Makes ls output an XML representation of the keys, instead of an
92              ls-compatible output.
93
94       -l     Causes to display long results. With ls, will generate lists
95              similar to ls -l. With get, will show also the key name.
96
97       -a     Causes ls to display also inactive keys. Generate lists similar
98              to ls -a. Inactive keys are keys which basename begins with a
99              '.' (dot). An example of inactive key:
100              system/sw/XFree/current/Monitor/.Monitor1
101
102       -f     Causes to work with full key names. A full key name makes sense
103              only on user/* keys, and differentiate from the regular key
104              names in specifying the owner user. If the current user is
105              someuser, the user/some/key full name is user:someuser/some/key.
106              Makes effect in ls, export and get subcommands.
107
108       -d     Causes get to work descriptivelly. When requesting a key it will
109              show the comment, key name and its value in a fancy format.
110              Causes set to mark the key as a directory key.
111
112       -s     Causes get and ls to be more friendly to Shell scripts. For
113              example, when requesting user/env/env2/PATH, the output will be
114              PATH="the value", that is, only the basename of the key will be
115              showed and the value will be surrounded by ' " '.
116
117       -t type
118              When setting a key's value, you can specify the type with this
119              switch. Currently accepted types are string for plain text, bin
120              for binary as-is values, dir to create folder keys and link to
121              create symbolic links between keys. Plain text are always stored
122              as UTF-8(7) in Elektra, regardeless of your current encoding
123              ($LANG). If you want to force a value to be stored without the
124              UTF-8(7) encoding (a bad idea), you can set it as binary. Binary
125              values should be avoided, because they are black boxes for
126              system administrators.
127
128       -b filename
129              Set the key value as the content of file filename. This option
130              is more usefull when setting binary keys.
131
132       -m mode
133              For the set command. Will set the key access permission to mode,
134              which must be an octal number as for chmod(1).
135
136       -u uid Create the key with uid user ID. It can be a user name or a uid
137              number.
138
139       -g gid Create the key with gid group ID. It can be a group name or a
140              gid number
141
142       -c comment
143              When setting keys, you can use this argument to set a
144              descriptive comment for it. This comment is exactly as a comment
145              in a plain text configuration file. The comment is stored as
146              UTF-8(7) regardeless of your current encoding ($LANG).
147
148       -v     With the ls subcommand, will make it show also the value stored
149              in the key.
150
151       --     With the set subcommand, everything after it will be considered
152              the value, even text with dashes (-).  Best Practices When
153              Creating Keys.PP When using Elektra to store your application's
154              configuration and state, please keep in mind the following
155              rules:
156
157       ·  You are not allowed to create keys right under system or user.
158
159       ·  You are not allowed to create folder keys right under system or
160          user. They are reserved for very essential OS subsystems.
161
162       ·  The keys for your application, called say MyApp, should be created
163          under system/sw/MyApp and/or user/sw/MyApp.
164

ENVIRONMENT

166       KDB_ROOT if defined, prepends it to key names.
167
168       KDB_BACKEND defines the name of another backend plugin library to use
169       ExamplesSetting Keys.PP bash$kdb set -c "My first key" user/example/key
170       "Some nice value"
171
172       bash$kdb set user:luciana/example/key -- "Some - nice - value with
173       dashes"
174
175       bash#KDB_ROOT=user:http/sw/httpd kdb set -u nobody -g http key "Some
176       value"
177
178       bash$kdb set -b image.png -t bin user/example/binaryKey
179
180       bash$kdb set -b file.txt user/example/regularKey
181
182       bash#kdb set -t link system/sw/XFree/current system/sw/XFree/handmade
183       Getting Keys.PP bash$KDB_ROOT=user/example kdb get some/key/name
184
185       bash$eval `kdb get -s user/env/env1/PS1`
186
187       bash$KDB_BACKEND=gconf kdb get
188       user/sw/gnome-terminal/global/active_encodings Listing.PP bash$kdb ls
189       -laR user:valeria
190
191       bash$kdb ls -lR system/sw/xorg/current
192
193       bash$KDB_ROOT=system/sw kdb ls -lR xorg
194
195       bash$KDB_BACKEND=fstab kdb ls -Rv system/filesystems
196
197       bash$eval `kdb ls -Rvs user/env/env2` Miscelaneous.PP bash#kdb ln
198       system/sw/xorg/handmade system/sw/xorg/current
199
200       bash#kdb mv system/sw/xorg/current system/sw/xorg/old
201
202       bash#kdb rm system/inittab/rc4
203
204       bash$KDB_BACKEND=gconf kdb rm user/gconfKey XML Import and Export.PP
205       bash#kdb export user/sw/app | sed -e 's|/app/|/app2/|g' | kdb import
206
207       bash#KDB_ROOT=system/sw kdb export myapp > myappconf.xml
208
209       bash#kdb import myappconf.xml
210
211       bash$KDB_BACKEND=gconf kdb export user/sw
212

SEE ALSO

214       elektra(7), elektra(5)
215

AUTHOR

217       Avi Alkalay <avi at unix.sh>.
218
219
220
221Elektra Initiative                March 2004                            KDB(1)
Impressum