Use GPG to symmetrically encrypt file using AES

GPG is typically used for public/private key encryption, but can also be used for encrypting content symmetrically by using the -c or --symmetric flag.

$ gpg --cipher-algo AES256 -c file.txt
Enter passphrase:
Repeat passphrase:

You will now have a file named file.txt.gpg. To decrypt the file again using the -d or --decrypt flag.

$ gpg -d file.txt.gpg
gpg: AES256 encrypted data
Enter passphrase: 

This will output the decrypted data to your console, you can write the decrypted content to a file using the -o or --output flag.

$ gpg -o file.txt -d file.txt.gpg

via nixCraft