Forrest logo
back to the gpg tool

gpg:tldr:d7e0d

gpg: Encrypt `doc.txt` with only a passphrase (output to `doc.txt.gpg`).
$ gpg --symmetric ${doc-txt}
try on your machine

The command gpg --symmetric ${doc-txt} is used for encrypting a file using symmetric encryption with GnuPG (GPG).

Here is a breakdown of each component:

  • gpg: This is the command for GnuPG, a free and open-source encryption program commonly used for encryption and decryption tasks.

  • --symmetric: This option instructs GPG to use symmetric encryption. Symmetric encryption uses the same key for both encryption and decryption, unlike asymmetric encryption that uses different keys for each process.

  • ${doc-txt}: This is a placeholder for the name or location of the file you want to encrypt. You need to provide the actual path and name of the file in place of ${doc-txt}. For example, if the file you want to encrypt is named document.txt and is located in the current working directory, you would replace ${doc-txt} with document.txt.

When you run this command after replacing the placeholder, GPG will encrypt the specified file using symmetric encryption and prompt you to enter a passphrase. The passphrase is used to protect the encrypted file, so make sure to choose a strong and memorable one. Once the encryption process is complete, you will have a file with the same name as the original but with the .gpg extension.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the gpg tool