How to Easily Encrypt a File in Linux!

Encrypting files is useful but the majority of the people that try to accomplish such, eventually give up because they find that it is too complicated and tedious… In this post, I will easily describe how to encrypt files on Linux!


In order to easily encrypt files on Linux, we will need to fulfill a few pre-requisites first! In order to do so, you can simply follow the instructions on installing the software below! Beware, only run the commands for your specific system!

Arch Linux

sudo pacman -S gnupg


sudo apt install gnupg

And that’s all the pre-requisites well be needing for this tutorial!!! If your system is not specified above, please leave a comment below for future reference!

Encrypting the Files!

Finally, after all that hard work (yeah right: ) ), we can begin encrypting files at our will! Let’s start off by encrypting the files that we want to! So, to simply encrypt one file we can run the below command. Make sure to replace FILENAME with your filename!

Encrypting Files

After the above command successfully┬áruns, the output will be something like FILENAME.gpg, this lets us know that the file is encrypted with GPG! You may also realize that it left the unencrypted version alone and that it still exists… For the next time you want to encrypt a file and you want to remove the unencrypted version while encrypting you can run the following command:

Decrypting Files

As simple as it was to encrypt files, it is even simpler to decrypt them! To decrypt your encrypted files, you can simply run the following command:

gpg -d FILENAME.gpg

And, depending on your GnuGPG version, you may or may not need to use the option-d… It may also be important to note that you may not even need to enter your encryption password if you decrypt on the same machine that you encrypted with… This is because by default GnuGPG uses symmetric encryption, meaning that it encrypts data and decrypts data with the same key… This key can be found at ~/.gnupg


In summary, encrypting files on Linux has never been easier and there has never been a better time to do so… Especially with our human privacy rights dwindling!

If you feel like you have a post suggestion, please feel free to leave a comment below!

Leave a Reply

Your email address will not be published. Required fields are marked *