karellen@localhost:~$ keepassxc-cli generate -lU
hpJUwcYZnzJyAbrnvTWnTzrlqzqcdvsl
karellen@localhost:~$ keepassxc-cli diceware
diabetes dinginess goldfish purr cried expenses related
See `keepassxc-cli help generate` and `keepassxc-cli help diceware` for more info, or the man page: https://manpages.debian.org/bullseye/keepassxc/keepassxc-cli... sort -R /usr/share/dict/words | head -n 4| sed 's/.*/&/;$!s/$// ' |tr '\n' '-' |sed 's/-$/\n/' sort -R /usr/local/share/eff_short_wordlist_1.txt |awk '{print$2}' | head -n 4| tr '\n' '-' | sed 's/-$/\n/'> The shuf, shred, and sort commands sometimes need random data to do their work. For example, ‘sort -R’ must choose a hash function at random, and it needs random data to make this selection.
> By default these commands use an internal pseudo-random generator initialized by a small amount of entropy, but can be directed to use an external source with the --random-source=file option. An error is reported if file does not contain enough bytes.
-- https://www.gnu.org/software/coreutils/manual/html_node/Rand...
(emphasis mine)
You might end up with a fairly easy-to-brute-force password using that method.
They say "never roll your own crypto", but I think that advice probably holds pretty well for password generators(/managers). I'll stick with using a dedicated program. I reckon it's far less likely to have obvious blunders than something that's just been cobbled together using whatever tools happened to be lying around nearby.
I use it for usernames since Bitwarden doesn’t support diceware names.
Say you want to generate a strong password, you can use this handy function that works in bash and zsh: