|A while ago we saw how to use GPG en Ubuntu to encrypt files, emails, etc. In this opportunity, we will see how to use GPG from the terminal, procedure that works for any distro Linux.|
To encrypt a file:
gpg -c file.txt
It will ask for a password (phrase) to encrypt it (if you lose the phrase or password you will no longer be able to recover your information).
The above command will generate a binary gpg file. If you prefer that it be encrypted in text mode and not in binary:
gpg -ca file
This will generate a sac file that you will be able to open with any text editor, but it will only see a lot of characters without apparent meaning.
If you want the encrypted file to have another name:
gpg -o encrypted_file.gpg -c file_to_encrypt
If you want to protect a folder that contains many files and subfolders, the ideal is to compress everything into a .TAR.GZ and then protect that file with GPG.
To decrypt it, it would be enough with:
gpg -d file.gpg
It will ask for the specified password (phrase) when encrypting it.
For more information see:
You can also take a look at the manual: