What does gpg do?

GNU Privacy Guard — encrypt, decrypt, and sign data.

▸ Explain your own gpg command →

gpg examples, explained

$ gpg -c secrets.txt

  • gpgGNU Privacy Guard — encrypt, decrypt, and sign data
  • -cencrypt with a symmetric passphrase (no keys needed)
  • secrets.txtan argument passed to the command

$ gpg -e -r alice@example.com report.pdf

  • gpgGNU Privacy Guard — encrypt, decrypt, and sign data
  • -eencrypt the input for one or more recipients
  • -rencrypt for this recipient (key ID or email)
  • alice@example.comvalue for -r
  • report.pdfan argument passed to the command

$ gpg -d secrets.txt.gpg

  • gpgGNU Privacy Guard — encrypt, decrypt, and sign data
  • -ddecrypt the input
  • secrets.txt.gpgan argument passed to the command

$ gpg --list-keys

  • gpgGNU Privacy Guard — encrypt, decrypt, and sign data
  • --list-keyslist the public keys in your keyring

gpg flags & options

-cencrypt with a symmetric passphrase (no keys needed)
-eencrypt the input for one or more recipients
-ddecrypt the input
-smake a signature
-aproduce ASCII-armored (text) output instead of binary
-bmake a detached signature (separate .sig file)
-vverbose output
-owrite output to this file
-rencrypt for this recipient (key ID or email)
-usign using this local key
--gen-keyinteractively generate a new key pair
--full-generate-keygenerate a key pair with all options prompted
--list-keyslist the public keys in your keyring
--exportexport a public key
--importimport keys from a file
--verifyverify a signature

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.