How to encrypt and decrypt the file in Linux


Sometimes you may need to send a important files as a attachment thru emails. Better if the files was sent in encryption mode then unauthorized person can’t misuse the file.

Now we will see here how to encrypt and decrypt the file in Linux.

To encrypt a file :

File can be encrypted using gpg command as shown below

#gpg -c test.txt>             

once you issued the command then you will get a popup window to enter the password twice.


Now the new encrypted file test.txt.gpg is created in the same directory and nobody can read the content in this file without decrypt the file and this can be done only who knows the password.

To make sure the file test.txt.gpg is decrypted, Run cat test.txt.gpg

Let see how to decrypt the test.txt.gpg to read the content

To Decrypt the file, just run gpg command without any option

#gpg test.txt.gpg

Now you will be prompted to enter the password, enter the password which you have set while encrypt the file.


Once password authentication successful then file will be decrypted and content is readeable.

I hope you like this article, If yes then Pls. share this article with your friends.

Recommended For You

About the Author: admin

Leave a Reply

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

Subscribe To Our Newsletter
Subscribe to our email newsletter today to receive updates on the latest news, tutorials and special offers!
No Thanks
Thanks for signing up. You must confirm your email address before we can send you. Please check your email and follow the instructions.
We respect your privacy. Your information is safe and will never be shared.
Don't miss out. Subscribe today.
WordPress Popup Plugin