Decrypting drives using the command line

Encrypted USB drives are fairly easy to use on most linux desktops. Whatever automount supplier you’re running with will pop up a dialogue window asking for the password to decrypt. But what if you want to use the terminal?

The use case for this is my server/HTPC which has a backup drive permanently attached to it. In order to have some offline backup as well, I want to plug in an encrypted USB pen drive and sync the contents of the backup drive to it. Having physical access but not a very good means of interacting with the desktop (I have bluetooth keyboard in a drawer but at hand the only thing is a controller…) is somewhat unusual so it took me some time to figure this out.