{\ttfamily kdb get $<$key name$>$}

Where {\ttfamily key name} is the name of the key.

This command is used to retrieve the value of a key.

If you enter a {\ttfamily key name} starting with a leading {\ttfamily /}, then a cascading lookup will be performed in order to attempt to locate the key. In this case, using the {\ttfamily -\/v} option allows the user to see the full key name of the key if it is found.

Only keys within the mount point or below the {\ttfamily $<$key name$>$} will be considered during a cascading lookup. A workaround is to pass the {\ttfamily -\/a} option. Use the command {\ttfamily kdb get -\/v $<$key name$>$} to see if an override or a fallback was considered by the lookup.

This command will return the following values as an exit status\+:


\begin{DoxyItemize}
\item 0\+: No errors.
\item 1-\/10\+: standard exit codes, see \hyperlink{doc_help_kdb_md}{kdb(1)}
\item 11\+: No key found.
\end{DoxyItemize}


\begin{DoxyItemize}
\item {\ttfamily -\/H}, {\ttfamily -\/-\/help}\+: Show the man page.
\item {\ttfamily -\/V}, {\ttfamily -\/-\/version}\+: Print version info.
\item {\ttfamily -\/p}, {\ttfamily -\/-\/profile $<$profile$>$}\+: Use a different kdb profile.
\item {\ttfamily -\/C}, {\ttfamily -\/-\/color $<$when$>$}\+: Print never/auto(default)/always colored output.
\item {\ttfamily -\/a}, {\ttfamily -\/-\/all}\+: Consider all of the keys.
\item {\ttfamily -\/n}, {\ttfamily -\/-\/no-\/newline}\+: Suppress the newline at the end of the output.
\item {\ttfamily -\/v}, {\ttfamily -\/-\/verbose}\+: Explain what is happening. Gives a complete trace of all tried keys. Very useful to debug fallback and overrides.
\item {\ttfamily -\/d}, {\ttfamily -\/-\/debug}\+: Give debug information. Prints additional debug information in case of errors/warnings.
\end{DoxyItemize}


\begin{DoxyCode}
# Backup-and-Restore: user:/tests/get/examples

# We use the `dump` plugin, since some storage plugins, e.g. INI,
# create intermediate keys.
sudo kdb mount get.ecf user:/tests/get/examples/kdb-get dump
sudo kdb mount get.ecf spec:/tests/get/examples/kdb-get dump

# Create the keys we use for the examples
kdb set user:/tests/get/examples/kdb-get/key myKey
kdb meta-set /tests/get/examples/kdb-get/anotherKey default defaultValue

# To get the value of a key:
kdb get user:/tests/get/examples/kdb-get/key
#> myKey

# To get the value of a key using a cascading lookup:
kdb get /tests/get/examples/kdb-get/key
#> myKey

# To get the value of a key without adding a newline to the end of it:
kdb get -n /tests/get/examples/kdb-get/key
#> myKey

# To explain why a specific key was used (for cascading keys):
kdb get -v /tests/get/examples/kdb-get/key
#> got 3 keys
#> searching spec:/tests/get/examples/kdb-get/key, found: <nothing>, options: KDB\_O\_CALLBACK
#>     searching proc:/tests/get/examples/kdb-get/key, found: <nothing>
#>     searching dir:/tests/get/examples/kdb-get/key, found: <nothing>
#>     searching user:/tests/get/examples/kdb-get/key, found: user:/tests/get/examples/kdb-get/key
#> The resulting keyname is user:/tests/get/examples/kdb-get/key
#> The resulting value size is 6
#> myKey

# Output if only a default value is set for a key:
kdb get -v /tests/get/examples/kdb-get/anotherKey
#> got 3 keys
#> searching spec:/tests/get/examples/kdb-get/anotherKey, found:
       spec:/tests/get/examples/kdb-get/anotherKey, options: KDB\_O\_CALLBACK
#> The key was not found in any other namespace, taking the default
#> The resulting keyname is default:/tests/get/examples/kdb-get/anotherKey
#> The resulting value size is 13
#> defaultValue

kdb rm user:/tests/get/examples/kdb-get/key
kdb rm spec:/tests/get/examples/kdb-get/anotherKey
sudo kdb umount user:/tests/get/examples/kdb-get
sudo kdb umount spec:/tests/get/examples/kdb-get
\end{DoxyCode}


To use bookmarks\+:~\newline
 {\ttfamily kdb get +kdb/format}

This command will actually get {\ttfamily user\+:/sw/elektra/kdb/\#0/current/format} if the bookmarks commands from \hyperlink{doc_help_kdb-set_md}{kdb-\/set(1)} man pages are executed before.


\begin{DoxyItemize}
\item \hyperlink{doc_help_kdb_md}{kdb(1)} for how to configure the kdb utility and use the bookmarks.
\item For more about cascading keys see \hyperlink{doc_help_elektra-cascading_md}{elektra-\/cascading(7)}
\item To get keys in shell scripts, you also can use \hyperlink{doc_help_kdb-sget_md}{kdb-\/sget(1)}
\item \hyperlink{doc_help_elektra-key-names_md}{elektra-\/key-\/names(7)} for an explanation of key names. 
\end{DoxyItemize}