Cheatsheets:Keepassxc-cli: Difference between revisions

From Wikibase
Jump to navigation Jump to search
No edit summary
Rewrite the command sections in REPL form, add option tables for add/edit, generate, ls, show; fix the Search lead-in that rendered as preformatted text and a few typos. Implemented the HTML-comment advice (comments now removed). AI-assisted (RonzzWikiCowriter) (via update-page on MediaWiki MCP Server)
Line 1: Line 1:
{{DesktopLinux}}
{{DesktopLinux}}


<code>keepassxc-cli</code> is the command-line client of [[FOSS:KeePassXC|KeePassXC]]: it can open, read and edit the same encrypted <code>.kdbx</code> databases just like the desktop application to manage your secrets
<code>keepassxc-cli</code> is the command-line client of [[FOSS:KeePassXC|KeePassXC]]: it can open, read and edit the same encrypted <code>.kdbx</code> databases as the desktop application, to manage your secrets from a terminal.


New to it?  
New to it?  
Line 11: Line 11:
== DB ops ==
== DB ops ==


KeePassXC store all your secrets in encrypted <code>.kdbx</code> files.
KeePassXC stores all your secrets in encrypted <code>.kdbx</code> files.


<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
Line 33: Line 33:
== Keepassxc-cli repl ==
== Keepassxc-cli repl ==


Once the <code>.kdbx</code> is set up, The first step to interact with it is almost always to enter the command repl on a particular <code>.kdbx</code> database, otherwise you have to retype the master password for every single command.
Once the <code>.kdbx</code> is set up, the first step to interact with it is almost always to enter the command repl on a particular <code>.kdbx</code> database, otherwise you have to retype the master password for every single command.


<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
keepassxc-cli open Passwords.kdbx     # enter a keepassxc-cli repl on Passwords.kdbx shell-style session, the prompt is the database name
keepassxc-cli open Passwords.kdbx             # enter a repl on Passwords.kdbx; the prompt is the database name
keepassxc-cli -k keyfile open Passwords.kdbx  # if a key file is also required
keepassxc-cli -k keyfile open Passwords.kdbx  # ...if a key file is also required
</syntaxhighlight>
</syntaxhighlight>


Line 45: Line 45:
Passwords&gt; clip -t Internet/site1
Passwords&gt; clip -t Internet/site1
Passwords&gt; close                  # close the current database, stay in the repl
Passwords&gt; close                  # close the current database, stay in the repl
Passwords&gt; exit                    # exist repl
Passwords&gt; exit                    # exit the repl
</pre>
</pre>


<blockquote>
<blockquote>
<code>export</code> and <code>import</code> do not work in repl
<code>export</code> and <code>import</code> do not work in the repl.
 
Every other command works in both forms: <code>Passwords&gt; ls</code> inside the repl, <code>keepassxc-cli ls Passwords.kdbx</code> outside it, the database being then the first argument. The sections below use the repl form.
</blockquote>
</blockquote>


<!-- all following sections should be rewritten as commands inside the repl when possible: e.g., keepassxc-cli ls db.kdbx becomes Passwords&gt; ls-->
== Edit secrets ==
== Edit secrets ==


<!-- use option tables in this section, as the command structures and options for add/edit are extremely similar-->
'''add''' creates an entry, '''edit''' changes one, '''rm''' deletes it, and '''mkdir''', '''mv''' and '''rmdir''' organise the groups:


<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
keepassxc-cli add -u user1 -g db.kdbx Internet/site3          # -g: generate the password
Passwords&gt; add -u user1 -g Internet/site3          # -g: generate the password
keepassxc-cli add -u user1 -p db.kdbx Internet/site3          # -p: prompt for the password
Passwords&gt; add -u user1 -p Internet/site3          # -p: prompt for the password
keepassxc-cli add -u user1 -g -L 24 -s db.kdbx Internet/site3  # generated: 24 characters, special ones included
Passwords&gt; add -u user1 -g -L 24 -s Internet/site3  # generated: 24 characters, special ones included
keepassxc-cli add -u user1 -g --url https://example.com db.kdbx Internet/site3
Passwords&gt; add -u user1 -g --url https://example.com Internet/site3
Passwords&gt; edit -u user2 Internet/site3            # change one field
Passwords&gt; edit -t Mail Internet/site3            # rename the entry
Passwords&gt; edit -g Internet/site3                  # replace the password with a generated one
Passwords&gt; rm Internet/site3                      # delete: to the recycle bin, when one is enabled
Passwords&gt; mkdir Internet/Sub                      # new group; parent groups must exist
Passwords&gt; mv Internet/site3 Work                  # move an entry to another group
Passwords&gt; rmdir Work                              # remove a group
</syntaxhighlight>
</syntaxhighlight>


<syntaxhighlight lang="bash" copy>
<code>add</code> and <code>edit</code> take the same options, except <code>-t</code>:
keepassxc-cli edit -u user2 db.kdbx Internet/site3  # change one field
 
keepassxc-cli edit -t Mail db.kdbx Internet/site3    # rename (-t is --title here, not TOTP)
{| class="wikitable"
keepassxc-cli edit -g db.kdbx Internet/site3        # replace the password with a generated one
! Option !! Effect
keepassxc-cli edit -p db.kdbx Internet/site3        # ...or type a new one
|-
keepassxc-cli rm db.kdbx Internet/site3              # delete: to the recycle bin, when one is enabled
| <code>-u NAME</code>, <code>--username</code> || set the username
</syntaxhighlight>
|-
| <code>--url URL</code> || set the URL
|-
| <code>--notes TEXT</code> || set the notes; <code>\n</code> becomes a line break
|-
| <code>-p</code>, <code>--password-prompt</code> || ask for the entry's password
|-
| <code>-g</code>, <code>--generate</code> || generate the entry's password (see [[#Generate passwords|the generator options]])
|-
| <code>-t TITLE</code>, <code>--title</code> || rename the entry — <code>edit</code> only
|}


<syntaxhighlight lang="bash" copy>
<blockquote>
keepassxc-cli mkdir db.kdbx Internet/Sub      # new group; parent groups must exist
<code>edit</code> refuses to run without at least one field option: <code>Not changing any field for entry Internet/site3.</code>
keepassxc-cli mv db.kdbx Internet/site3 Work  # move an entry to another group
</blockquote>
keepassxc-cli rmdir db.kdbx Work              # remove a group
</syntaxhighlight>


<blockquote>
<blockquote>
<code>-p</code> prompts for the entry's password, but like the master password it only reads <code>stdin</code>: two lines, in order — master password, then the entry's:
<code>-p</code> reads the entry's password from <code>stdin</code>, like the master password does. As a one-off command outside the repl, the two lines come in order — master password, then the entry's:
 
<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
printf 'masterpass\nnewpass\n' | keepassxc-cli -q add -p -u user1 db.kdbx Internet/site3
printf 'masterpass\nnewpass\n' | keepassxc-cli -q add -p -u user1 db.kdbx Internet/site3
Line 88: Line 105:


<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
keepassxc-cli generate                          # 16 characters: lowercase, uppercase, digits
Passwords&gt; generate                          # 16 characters: lowercase, uppercase, digits
keepassxc-cli generate -L 24 -s                # 24 characters, special ones included
Passwords&gt; generate -L 24 -s                # 24 characters, special ones included
keepassxc-cli generate -L 20 --exclude-similar  # avoid look-alikes such as l, 1 and I
Passwords&gt; generate -L 20 --exclude-similar  # avoid look-alikes such as l, 1 and I
keepassxc-cli generate -x 'a,b,c'              # exclude individual characters
Passwords&gt; generate -x 'a,b,c'              # exclude individual characters
keepassxc-cli generate -c 'abcdef1234'          # only from these characters
Passwords&gt; generate -c 'abcdef1234'          # only from these characters
keepassxc-cli generate -e                       # add extended ASCII
Passwords&gt; generate --every-group            # at least one character from every selected group
keepassxc-cli generate --every-group           # at least one character from every selected group
</syntaxhighlight>
keepassxc-cli diceware                         # 7-word passphrase
 
keepassxc-cli diceware -W 5                     # 5 words
The same options apply to <code>generate</code>, to <code>add -g</code> and to <code>edit -g</code>:
keepassxc-cli diceware -w wordlist.txt         # custom word list
 
keepassxc-cli estimate 'some_password'          # entropy of a given password
{| class="wikitable"
keepassxc-cli estimate -a 'some_password'      # ...with advanced analysis
! Option !! Effect
|-
| <code>-L N</code>, <code>--length</code> || length of the password, 16 by default
|-
| <code>-l</code>, <code>--lower</code> || lowercase letters (enabled by default)
|-
| <code>-U</code>, <code>--upper</code> || uppercase letters (enabled by default)
|-
| <code>-n</code>, <code>--numeric</code> || digits (enabled by default)
|-
| <code>-s</code>, <code>--special</code> || special characters (disabled by default)
|-
| <code>-e</code>, <code>--extended</code> || extended ASCII characters (disabled by default)
|-
| <code>-x CHARS</code>, <code>--exclude</code> || exclude these characters, comma-separated
|-
| <code>-c CHARS</code>, <code>--custom</code> || draw from these characters only
|-
| <code>--exclude-similar</code> || drop look-alikes such as <code>l</code>, <code>1</code> and <code>I</code>
|-
| <code>--every-group</code> || at least one character from every selected class
|}
 
'''diceware''' — passphrases:
 
<syntaxhighlight lang="bash" copy>
Passwords&gt; diceware                 # 7 words
Passwords&gt; diceware -W 5             # 5 words
Passwords&gt; diceware -w wordlist.txt # custom word list
</syntaxhighlight>
</syntaxhighlight>


<!-- use option tables in this section, as the command structures/behaviour are extremely similar -->
{| class="wikitable"
! Option !! Effect
|-
| <code>-W N</code>, <code>--words</code> || number of words, 7 by default
|-
| <code>-w FILE</code>, <code>--word-list</code> || custom word list: more than 1000 words are required, and a warning is printed below 4000
|}
 
'''estimate''' — entropy of a password:
 
<syntaxhighlight lang="bash" copy>
Passwords&gt; estimate 'some_password'    # entropy of a given password
Passwords&gt; estimate -a 'some_password'  # -a: advanced analysis
</syntaxhighlight>


== List ==
== List ==


<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
keepassxc-cli ls db.kdbx                  # root group: entries, then sub-groups
Passwords&gt; ls           # root group: entries, then sub-groups
keepassxc-cli ls db.kdbx Internet         # one group
Passwords&gt; ls Internet   # one group
keepassxc-cli ls -R db.kdbx                # recurse into every group
Passwords&gt; ls -R         # recurse into every group
keepassxc-cli ls -f -R db.kdbx            # -f: flatten, one full path per line
Passwords&gt; ls -f -R     # one full path per line
</syntaxhighlight>
</syntaxhighlight>


<!-- use an options table instead for ls -f and -R-->
{| class="wikitable"
! Option !! Effect
|-
| <code>-R</code>, <code>--recursive</code> || list the contents of the sub-groups too
|-
| <code>-f</code>, <code>--flatten</code> || print <code>group-path/title</code> on one line per entry, instead of an indented tree
|}


== Search ==
== Search ==


<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
keepassxc-cli search db.kdbx site          # entries matching a term
Passwords&gt; search site          # entries matching a term
keepassxc-cli search db.kdbx 'title:mail'  # field-qualified term
Passwords&gt; search 'title:mail'  # field-qualified term
keepassxc-cli search db.kdbx 'has:totp'    # every entry with TOTP set up
Passwords&gt; search 'has:totp'    # every entry with TOTP set up
</syntaxhighlight>
</syntaxhighlight>


the same query language as in the GUI search box:
'''search''' — the same query language as in the GUI search box:


{| class="wikitable"
{| class="wikitable"
Line 144: Line 208:


<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
keepassxc-cli show db.kdbx site1                   # -s: reveal protected values too
Passwords&gt; show site1                                    # default fields; the password reads PROTECTED
keepassxc-cli show -a username -a password db.kdbx Internet/site1  # show specific attributes, one per line
Passwords&gt; show -s Internet/site1                       # -s: reveal protected values too
keepassxc-cli show --all db.kdbx site1              # every attribute, custom ones included
Passwords&gt; show -a username -a password Internet/site1  # specific attributes, one per line
keepassxc-cli show --show-attachments db.kdbx site1 # attachment names and sizes
</syntaxhighlight>
</syntaxhighlight>


<!-- use an options table instead for --all, --show-attachments -->
{| class="wikitable"
! Option !! Effect
|-
| <code>-a ATTR</code>, <code>--attributes</code> || print the named attribute, without its field label; repeat the flag for several, printed one per line
|-
| <code>-s</code>, <code>--show-protected</code> || reveal protected values in clear text
|-
| <code>--all</code> || every attribute, custom ones included
|-
| <code>--show-attachments</code> || attachment names and sizes
|-
| <code>-t</code>, <code>--totp</code> || the current TOTP code (see [[#TOTP]])
|}


Naming the attribute is what makes the output script-friendly:
Naming the attribute is what makes the output script-friendly:


<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
PASSWORD="$(keepassxc-cli -q show -a password db.kdbx Internet/site1)"
PASSWORD="$(keepassxc-cli -q show -a password Passwords.kdbx Internet/site1)"
</syntaxhighlight>
</syntaxhighlight>


Line 166: Line 241:
== Clip: Copy to the clipboard ==
== Clip: Copy to the clipboard ==


Replace <code>show</code> with <code>clip</code> to copy to clipboard instead of printing to <code>stout</code>.
Replace <code>show</code> with <code>clip</code> to copy to the clipboard instead of printing to <code>stdout</code>.


<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
keepassxc-cli clip db.kdbx site1               # copy password of the entry to the clipboard. clipboard will be cleared after 10 s
Passwords&gt; clip site1             # copy the password; the clipboard is cleared after 10 s
keepassxc-cli clip -a username db.kdbx site1   # copy any attribute of the entry: username, url, notes, ...
Passwords&gt; clip -a username site1 # copy any attribute of the entry: username, url, notes, ...
keepassxc-cli clip -t db.kdbx site1           # copy current totp code to system clipboard
Passwords&gt; clip -t site1           # copy the current TOTP code to the clipboard
Passwords&gt; clip site1 30          # clear after 30 s instead; 0 keeps it until it is overwritten
Passwords&gt; clip -b github          # unique title match only, no group path needed
</syntaxhighlight>
</syntaxhighlight>


Line 181: Line 258:


<blockquote>
<blockquote>
'''Caveat''': <code>keepassxc-cli</code> currently only supports generating TOTP from an entry already setup. The setup must be done in GUI.
'''Caveat''': <code>keepassxc-cli</code> currently only supports generating a TOTP from an entry already set up. The setup must be done in the GUI.
</blockquote>
</blockquote>


<syntaxhighlight lang="bash" copy>
<syntaxhighlight lang="bash" copy>
keepassxc-cli show -t db.kdbx site1                         # show the current code
Passwords&gt; show -t site1                    # show the current code
OTP="$(keepassxc-cli -q show -t db.kdbx site1)"             # code only, for a scripted login
Passwords&gt; show -a password -t Internet/site1  # ...alongside other fields
keepassxc-cli show -a otp db.kdbx site1                    # the stored otpauth:// secret, to enrol another device
Passwords&gt; clip -t site1                   # copy the code to the clipboard
Passwords&gt; show -a otp site1                # the stored otpauth:// secret, to enrol another device
OTP="$(keepassxc-cli -q show -t Passwords.kdbx site1)"   # code only, outside the repl, for a scripted login
</syntaxhighlight>
</syntaxhighlight>


Line 204: Line 283:
|-
|-
| <code>Attribute "X" not found.</code> || wrong attribute name: list them with <code>show --all</code>
| <code>Attribute "X" not found.</code> || wrong attribute name: list them with <code>show --all</code>
|-
| <code>Not changing any field for entry X.</code> || <code>edit</code> was given no field option: pass at least one, e.g. <code>edit -u user2 Internet/site3</code>
|-
| the command waits for input in a script || the master password is read from <code>stdin</code>: pipe it, or unlock with <code>-k keyfile</code>
|}
|}



Revision as of 09:54, 30 September 2026

Languages: English · français · Esperanto

Quick reference for smart people — part of our Linux cheatsheets collection.

keepassxc-cli is the command-line client of KeePassXC: it can open, read and edit the same encrypted .kdbx databases as the desktop application, to manage your secrets from a terminal.

New to it?

  • keepassxc-cli help lists every command
  • keepassxc-cli <command> -h documents one command
  • man keepassxc-cli provides a full reference

DB ops

KeePassXC stores all your secrets in encrypted .kdbx files.

keepassxc-cli db-create -p db.kdbx                         # create a new database
keepassxc-cli db-create --set-key-file keyfile db.kdbx     # create a new database protected by a key file
keepassxc-cli db-info db.kdbx                              # show info on a .kdbx DB
keepassxc-cli db-edit -p db.kdbx                           # change the master password
keepassxc-cli db-edit --set-key-file keyfile db.kdbx       # add or replace the key file
keepassxc-cli db-edit --unset-password db.kdbx             # remove the password encryption
keepassxc-cli export -f csv db.kdbx > export.csv           # export every secret to csv in clear text
keepassxc-cli export -f xml db.kdbx > export.xml           # export every secret to xml to be reimported into another .kdbx
keepassxc-cli import export.xml new.kdbx                   # import from a previously exported .xml into a new database

Any file created by export should be considered extremely sensitive, as it contains all your secrets in clear text.

import currently only accepts a .xml file previously exported by KeePassXC.

Keepassxc-cli repl

Once the .kdbx is set up, the first step to interact with it is almost always to enter the command repl on a particular .kdbx database, otherwise you have to retype the master password for every single command.

keepassxc-cli open Passwords.kdbx             # enter a repl on Passwords.kdbx; the prompt is the database name
keepassxc-cli -k keyfile open Passwords.kdbx  # ...if a key file is also required
Passwords> ls
Passwords> show -s Internet/site1
Passwords> clip -t Internet/site1
Passwords> close                   # close the current database, stay in the repl
Passwords> exit                    # exit the repl

export and import do not work in the repl.

Every other command works in both forms: Passwords> ls inside the repl, keepassxc-cli ls Passwords.kdbx outside it, the database being then the first argument. The sections below use the repl form.

Edit secrets

add creates an entry, edit changes one, rm deletes it, and mkdir, mv and rmdir organise the groups:

Passwords&gt; add -u user1 -g Internet/site3           # -g: generate the password
Passwords&gt; add -u user1 -p Internet/site3           # -p: prompt for the password
Passwords&gt; add -u user1 -g -L 24 -s Internet/site3  # generated: 24 characters, special ones included
Passwords&gt; add -u user1 -g --url https://example.com Internet/site3
Passwords&gt; edit -u user2 Internet/site3            # change one field
Passwords&gt; edit -t Mail Internet/site3             # rename the entry
Passwords&gt; edit -g Internet/site3                  # replace the password with a generated one
Passwords&gt; rm Internet/site3                       # delete: to the recycle bin, when one is enabled
Passwords&gt; mkdir Internet/Sub                      # new group; parent groups must exist
Passwords&gt; mv Internet/site3 Work                  # move an entry to another group
Passwords&gt; rmdir Work                              # remove a group

add and edit take the same options, except -t:

Option Effect
-u NAME, --username set the username
--url URL set the URL
--notes TEXT set the notes; \n becomes a line break
-p, --password-prompt ask for the entry's password
-g, --generate generate the entry's password (see the generator options)
-t TITLE, --title rename the entry — edit only

edit refuses to run without at least one field option: Not changing any field for entry Internet/site3.

-p reads the entry's password from stdin, like the master password does. As a one-off command outside the repl, the two lines come in order — master password, then the entry's:

printf 'masterpass\nnewpass\n' | keepassxc-cli -q add -p -u user1 db.kdbx Internet/site3

Generate passwords

Passwords&gt; generate                          # 16 characters: lowercase, uppercase, digits
Passwords&gt; generate -L 24 -s                 # 24 characters, special ones included
Passwords&gt; generate -L 20 --exclude-similar  # avoid look-alikes such as l, 1 and I
Passwords&gt; generate -x 'a,b,c'               # exclude individual characters
Passwords&gt; generate -c 'abcdef1234'          # only from these characters
Passwords&gt; generate --every-group            # at least one character from every selected group

The same options apply to generate, to add -g and to edit -g:

Option Effect
-L N, --length length of the password, 16 by default
-l, --lower lowercase letters (enabled by default)
-U, --upper uppercase letters (enabled by default)
-n, --numeric digits (enabled by default)
-s, --special special characters (disabled by default)
-e, --extended extended ASCII characters (disabled by default)
-x CHARS, --exclude exclude these characters, comma-separated
-c CHARS, --custom draw from these characters only
--exclude-similar drop look-alikes such as l, 1 and I
--every-group at least one character from every selected class

diceware — passphrases:

Passwords&gt; diceware                  # 7 words
Passwords&gt; diceware -W 5             # 5 words
Passwords&gt; diceware -w wordlist.txt  # custom word list
Option Effect
-W N, --words number of words, 7 by default
-w FILE, --word-list custom word list: more than 1000 words are required, and a warning is printed below 4000

estimate — entropy of a password:

Passwords&gt; estimate 'some_password'     # entropy of a given password
Passwords&gt; estimate -a 'some_password'  # -a: advanced analysis

List

Passwords&gt; ls            # root group: entries, then sub-groups
Passwords&gt; ls Internet   # one group
Passwords&gt; ls -R         # recurse into every group
Passwords&gt; ls -f -R      # one full path per line
Option Effect
-R, --recursive list the contents of the sub-groups too
-f, --flatten print group-path/title on one line per entry, instead of an indented tree
Passwords&gt; search site          # entries matching a term
Passwords&gt; search 'title:mail'  # field-qualified term
Passwords&gt; search 'has:totp'    # every entry with TOTP set up

search — the same query language as in the GUI search box:

Syntax Matches
title:, username:, url:, notes:, group:, tag: one field only; abbreviated forms work (t:, u:, g:, ...)
has:totp entries with TOTP configured
is:weak, is:expired weak or expired passwords
!term excludes the term
+term exact term only, not as a substring
a|b either term

Show an entry

Passwords&gt; show site1                                    # default fields; the password reads PROTECTED
Passwords&gt; show -s Internet/site1                        # -s: reveal protected values too
Passwords&gt; show -a username -a password Internet/site1   # specific attributes, one per line
Option Effect
-a ATTR, --attributes print the named attribute, without its field label; repeat the flag for several, printed one per line
-s, --show-protected reveal protected values in clear text
--all every attribute, custom ones included
--show-attachments attachment names and sizes
-t, --totp the current TOTP code (see #TOTP)

Naming the attribute is what makes the output script-friendly:

PASSWORD="$(keepassxc-cli -q show -a password Passwords.kdbx Internet/site1)"

An entry can be addressed by title alone when that title is unique, otherwise it must be addressed by group-path/title.

ls -f -R prints every valid path.

Clip: Copy to the clipboard

Replace show with clip to copy to the clipboard instead of printing to stdout.

Passwords&gt; clip site1              # copy the password; the clipboard is cleared after 10 s
Passwords&gt; clip -a username site1  # copy any attribute of the entry: username, url, notes, ...
Passwords&gt; clip -t site1           # copy the current TOTP code to the clipboard
Passwords&gt; clip site1 30           # clear after 30 s instead; 0 keeps it until it is overwritten
Passwords&gt; clip -b github          # unique title match only, no group path needed

On Linux, clip pipes to wl-copy (Wayland) or xclip (X11); without either one it fails with error All clipping programs failed.

TOTP

Caveat: keepassxc-cli currently only supports generating a TOTP from an entry already set up. The setup must be done in the GUI.

Passwords&gt; show -t site1                    # show the current code
Passwords&gt; show -a password -t Internet/site1   # ...alongside other fields
Passwords&gt; clip -t site1                    # copy the code to the clipboard
Passwords&gt; show -a otp site1                # the stored otpauth:// secret, to enrol another device
OTP="$(keepassxc-cli -q show -t Passwords.kdbx site1)"   # code only, outside the repl, for a scripted login

The code is computed locally from the secret stored in the entry and the local system clock time. A drifting system clock would generate invalid codes.

Common errors

Message Cause and fix
All clipping programs failed. neither wl-copy nor xclip is installed: install one for clip to work
Could not find entry with path X. the title is not unique, or the group path is wrong: list the paths with ls -f -R
Attribute "X" not found. wrong attribute name: list them with show --all
Not changing any field for entry X. edit was given no field option: pass at least one, e.g. edit -u user2 Internet/site3
the command waits for input in a script the master password is read from stdin: pipe it, or unlock with -k keyfile

For more

  • KeePassXC user guide — the official guide: TOTP setup, search syntax, browser and SSH agent integration
  • keepassxc-cli(1) man page — every command and every option
  • keepassxc-cli help and man keepassxc-cli — the same reference, offline
  • analyze — offline Have I Been Pwned check against a downloaded password-hash list
  • merge — merge two databases into one
  • attachment-import, attachment-export, attachment-rm — manage file attachments
  • Cheatsheets:LinuxCLI/ssh — SSH keys and ssh-agent, which KeePassXC can feed