Copy a TOTP code to the clipboard

keepassxc-cli

keepassxc-cli clip --totp {{path/to/database_file}} {{entry_name}}

click the source code to copy install keepassxc-cli on any operating system with command-not-found.com