How to Decrypt a File using GnuPG.
May 28 2017

0  3K+ {{}}
Welcome back, in this tutorial I will show you how to decrypt a file using GnuPG on xShellz Shell (Paid/Free)
If you haven't seen the "How to Encrypt a file using GnuPG" article, Go see it first.

1. Change your Directory. (Change your directory to the directory which you have the encrypted file placed. Which in my case is the "test1" directory. We will use the cd command to change directory)

cd test1/

2. Create a new file named "". (Now create a file with name, This will be the file which will decrypt the encrypted file your having)


3. Edit the file "". (Now edit the file using your favourite editor, In this tutorial we will be using Nano Editor)


4. Add the Decryption script to the text file (Now we will add the decryption script to the text file through nano editor. Copy/Paste the following script down below to the file)



echo "Welcome, I am ready to decrypt a file/folder for you"

echo "Currently I have a limitation, Place me to the same folder, where the file to be

decrypted is present"

echo "Enter the Exact File Name with extension"

read file;

gpg -d $file>DecryptedFile.txt

echo "I have decrypted the file succesfully"

echo "Now I will be removing the encrypted file"

rm -rf $file


5. Save the script to the file. (Now save the script to the file and exit from the editor)

CTRL+X (Hold Control key and press X)

6. Change the files access permissions to 755. (Now change the file access mode to 755, We use the command chmod to change/revoke a files permissions)

chmod 755

7. Execute the command "./" (Now execute the ./ command from the console. You will be promopted to state the file name and then to enter the password/passphrase once)


8. File is Decrypted now. (Your file is currently decrypted. Goto your directory and check for a file named "DecryptedFile.txt" for the decyrpted informations)

nano DecryptedFile.txt

Have Doubts/Questions? Please comment down below on the post or email me at BLinuxYT[at]
@Black Linux/Skyie/AutoBotIRC - Buuuuurp Geeky!

Please Login or Sign Up to leave a reply.