gpg to encrypt a file
8 Sep 2021
What if you want to encrypt/decrpyt a local file using a passphrase?
To encrypt, and not have gpg-agent not cache your passphrase:
$ gpg --no-symkey-cache --symmetric my_sensitive_file.txt
This will create a file my_sensitive_file.txt.gpg. You will still need to delete the original my_sensitive_file.txt!
And to decrypt:
$ gpg --no-symkey-cache --decrypt my_sensitive_file.txt.gpg > my_sensitive_file.txt