Decrypting GPG Files in Linux: A Quick Guide
In this article, we will discuss how to decrypt GPG files in Linux using the command line. GPG, or GNU Privacy Guard, is a free and open-source implementation of the OpenPGP standard. It is commonly used for data encryption and digital signatures. If you are familiar with decrypting GPG files but want to learn how to save the decrypted file to a specific folder instead of the current directory, this quick guide is for you.
Prerequisites
Before we begin, make sure you have a GPG file that you want to decrypt. For the purposes of this article, we will use the file example.gpg. Also, ensure that you have the GPG suite installed on your Linux system. If not, you can install it using your distribution's package manager.
Decrypting GPG Files
To decrypt a GPG file, use the gpg command followed by the --decrypt flag and the file name:
gpg --decrypt example.gpg
By default, the decrypted file will be saved in the current directory with the same name as the GPG file but without the .gpg extension.
Saving Decrypted Files to a Specific Folder
To save the decrypted file to a specific folder, use the --output flag followed by the path to the folder and the desired file name:
gpg --decrypt example.gpg --output /path/to/folder/decrypted_file
In this example, the decrypted file will be saved in the folder /path/to/folder with the name decrypted_file.
Decrypting Files with a Passphrase
If the GPG file is encrypted with a passphrase, you will be prompted to enter it when running the gpg command.
gpg --decrypt example.gpg
Enter the passphrase when prompted, and the file will be decrypted and saved in the current directory.
- GPG is a commonly used tool for data encryption and digital signatures in Linux.
- To decrypt a GPG file, use the
gpgcommand followed by the--decryptflag and the file name. - To save the decrypted file to a specific folder, use the
--outputflag followed by the path to the folder and the desired file name. - If the GPG file is encrypted with a passphrase, you will be prompted to enter it when running the
gpgcommand.