- Cheat Sheet and Example is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools






Linux Commands Cheat Sheet

gpg : How to use gpg command in Linux with examples

man gpg

       gpg2 - OpenPGP encryption and signing tool

       gpg2 [--homedir dir] [--options file] [options] command [args]

       gpg2  is  the  OpenPGP part of the GNU Privacy Guard (GnuPG). 
       It is a tool to provide digital encryption and signing services using the OpenPGP standard.


       -h     Print a usage message summarizing the most useful command line options. 
gpg --gen-key generate a new key pair
gpg --list-keys list keys
gpg --list-secret-keys list secret keys
gpg --delete-key remove keys from the public keyring
gpg --delete-secret-key remove keys from the secret keyring
gpg --delete-secret-and-public-key KeyID
gpg --fingerprint list keys and fingerprints
gpg --sign-key sign a key

Encrypt or Decrypt

gpg -e -r USER-ID FILE -e : encrypt data
-r USER-ID : encrypt for USER-ID
gpg FILE.gpg
gpg -d FILE.gpg
-d : decrypt data (default)

Import and Export Keys

gpg -a --export > FILE.asc
gpg -a --export > FILE.asc
--export : export keys
-a : create ascii armored output
gpg -o FILE.key --export --export : export keys
-o : write output to FILE (BINARY)
gpg -a --export-secret-key > FILE.asc -a : create ascii armored output
gpg -o private.key --export-secret-key -o : write output to FILE (BINARY)
gpg --import PublicKEY
gpg --import SecretKEY
import/merge keys

os/linux/command/gpg.html.txt ยท Last modified: 2018/02/09 by admin

Page Tools