The only reason this page exists is because I want to share code snippets and the way I currently have set up the Links section breaks these fancy codeblocks with syntax highlighting. In particular, I want to share my snippets on how to retrieve stuff you stored in your database via the command line.
Here's the keepassxc-cli manual page, for reference.
keepassxc-cli show -a "ATTRIBUTE" "PATH/TO/DATABASE.kdbx" "ENTRY"
# ATTRIBUTE is the attribute you want to get output (case in-sensitive)
# Reserved values: "title", "username", "password" (default when just using `-a`), "url", "notes", "uuid", "tags"
# For custom properties, they're the literal displayed name in quotes (e.g. "API Key")
# ENTRY is the display name of an entry (case sensitive, e.g. "Neocities (SquaredPancake)").
# It doesn't need the full directory path, just the name!
# The password for the database either...
# ...will be asked of you when you run the command
# ...can be automatically supplied via standard input (so prepending something like `echo "Password you use to open your database" | ` will do the trick)
# Basic template to get a secret via script:
unset HISTFILE
export SECRET_KEY="$(keepassxc-cli show -a "ATTRIBUTE" "PATH/TO/DATABASE.kdbx" "ENTRY")"
echo $SECRET_KEYAs a little bonus, here's also a similar "quick reminder" code snippet for KWallet as I used that for a while before switching over to KeePassXC. It's based off of the very helpful guide by TechTea as well as the Arch Wiki page:
kwallet-query -f "FOLDER" -r "PASSWORD" kdewallet
# FOLDER is the top-level folder in KWalletManager
# It defaults to the "Passwords" folder if no FOLDER is supplied
# PASSWORD is the verbatim display name of an entry in the Passwords "sub-folder"
# You can pass -w (write) instead of -r (read) to create or overwrite entries.
# Writing takes it's value from standard input, so prepending `echo "Password you want to save" | ` will do the trick.
# `kdewallet` is the wallet to query. kdewallet is the default one available, but others can be created in KWalletManager.
# Basic template to get a secret via script:
unset HISTFILE
export SECRET_KEY="$(kwallet-query -f "FOLDER" -r "PASSWORD" kdewallet)"
echo $SECRET_KEY