File Encryption the easy way!

  9 years ago

Hello you!

Looking for an easy way to encrypt a file using GNUPG? You already found some ways on the internet but they are very complicated or just too much in detail? Well then you're on the right place here!

I will show you how to encrypt any file you want.


Our Example is a picture called "Linux.png". 

Right click and open the terminal.     


Now type the following line into the console:

gpg --symmetric --cipher-algo AES256 Linux.png

Thats it! A file called "linux.png.gpg will be created in the same directory.


For decrypt the file, you simple have to type into the console the following line:

gpg -o Linux1.png Linux.png.gpg

Of course this will ask you for the password you've used when encrypting the file.

Important: If you decrypt a picture, you have to use the "-o command" with the decrypt code, otherwise you will see a lot of strange text ("Hex Code") inside your terminal, because GNUPG thinks, you try to decrypt text.


Ok, now the commands you've used before as a small list:



gpg --symmetric --cipher-algo AES256 FILENAME.x

This means you encrypt a file. You can replace AES256 with many other alogrithms. You can find a list of all possible algorithms under this list.


gpg -o FilenameYouWant.x NameOfTheEncryptedFile.x.gpg


If you decrypt text, you can use gpg -d NameOfTextFile

This will decrypt the file (*.gpg) and output the original file.


Important²: You can encrypt for example a Picture and encrypt it as a *.txt file.  Simply add -o (o for "output") before "symmetric". Example:

gpg -o NameYouWish.txt --symmetric --cipher-algo AES256 FileToEncrypt.png

This would encrypt a picture (*.png) and save it as a txt file.

To decrypt this, you just type the originial (in this case *.png) in the console code:

gpg -o FileToDecrypt.png NameOfTheEncryptedFile.txt













And now a list of algorithms you can use to encrypt files. The code is the same as shown before. Simply replace the "AES256" with one of these:

  • IDEA

  • 3DES

  • CAST5


  • AES

  • AES192, AES256



*You can always find this list my typing this into the console:  gpg --version


If you need help in any way, feel free to send me a message.

Hannibal1992 9 years ago

Thank you all for your comments and suggestions. :-)

lib2know 9 years ago

Thank you, while all world talks about
gpg (after donation campaigne they have a new employee)
you point out how easy it is in use,
even without GUI tools, thanks !
The good formatting was helpful as well.

Hammer459 9 years ago

Little hint. Don't be clever with typefaces and so on. Leave text normal size and font and the tutorial would have been readable. Now... large text layered on top of itself and pictures on top of that.
I can not make sense of half of your tutorial because I just can not read it :-(

Then as @ConorCork suggests, use what is available since it is easier and extremely functional.

ConorCork 9 years ago

For a non CLI terminal user, who may prefer a Graphical User Interface option, can simply use LM software manager to install two packages “seahorse” 3.10.2 and “kgpg” 2.3.1( Both work for author with LM 17 or 17.1 Cinnamon x64 bit kernel 3.13.0 -24 and – 37 ). Use Kgpg to create a Public/Private key pair. Then right mouse click on file wish to encrypt. At the menu Choose the key of the recipient (or your own key generated if encrypting file for your own use). Then click “Encrypt". To decrypt a file right mouse click-> “Open with decrypt file” . It will then open with the original file or if the original file deleted will prompt you for the decrypt password you used when generating your encryption key.