Privacy and encryption go together like peanut butter and jelly. At the very heart of most encryption strategies is a set of keys and a key exchange. Most of you have probably already heard of PGP (Pretty Good Privacy) and are confused about GPG.

Generate a strong 4096 bit key

gpg --full-generate-key

List generated keys

gpg --list-secret-keys

Upload key to default servers

gpg --send-keys <your_key_uid>

Specify a specific remote server

gpg --keyserver hkps://keyserver.ubuntu.com --send-keys <your_key_uid>

Exporting your key for orther devices

gpg --output sec_key.gpg --armor --export-secret-key <your_key_uid>

If all went well you should now have a public GPG key deployed to the Ubuntu Keyserver.

Encrypting and decrypting files

Encrypting

gpg --cipher-algo AES256 -c filename.tar.gz
This will ask you for a password

Decrypting

gpg -o filename.tar.gz -d filename.tar.gz.gpg