Frequently used Linux GPG 1.4 Commands and arguments
Confirming the GnuPG installation and version
sha256sum `which gpg1`
- Confirm gpg executable file has not been tampered with.
gpg1 --version
- Report gpg program version.
-
gpg1 --help
- List program usege summary.
-
gpg1 --dump-options
- List all implementd commands/options.
-
gpg1 --homedir directory
- Execute using an alternative keyring directory.
-
Listing Key Information
gpg1 --list-keys
- List all keys in public keyring.
gpg1 --list-packets keyfile.asc
- List "packets" of a ascii key file.
Importing, Exporting, Refreshing and Removing Keys
Importing
gpg1 --import file
- Import a key contained in file to the appropriate keyring.
Exporting
gpg1 -a --export keyId > keyFile.asc
- Output a public key to an ascii text file.
gpg1 -a --export-secret-keys keyId > keyFile.asc
- Output a private key to an ascii text file.
Creating and Editing a Keypair
gpg1 --gen-key
- Prompt for essential parameters and create the keypair.
faketime -f -2000d gpg1 --gen-key
- Generate key with a selected create date
gpg1 --gen-key --expert
- Prompt for every key parameter and create the keypair.
gpg1 --edit-key userId
- Edit key elements. (See manual).
Editing commands (at 'gpg>' prompt)
quit
- Quit this menu.
save
- Save and quit.
help
- Show this help.
fpr
- Show key fingerprint.
list
- List key and user IDs.
uid
- Select user ID N.
key
- Select subkey N.
check
- Check signatures.
sign
- Sign selected user IDs [* see below for related commands].
lsign
- Sign selected user IDs locally.
tsign
- Sign selected user IDs with a trust signature.
nrsign
- Sign selected user IDs with a non-revocable signature.
adduid
- Add a user ID.
addphoto
- Add a photo ID.
deluid
- Delete selected user IDs.
addkey
- Add a subkey.
delkey
- Delete selected subkeys.
addrevoker
- Add a revocation key.
delsig
- Delete signatures from the selected user IDs.
expire
- Change the expiration date for the key or selected subkeys.
primary
- Flag the selected user ID as primary.
toggle
- Toggle between the secret and public key listings.
pref
- List preferences (expert).
showpref
- List preferences (verbose).
setpref
- Set preference list for the selected user IDs.
keyserver
- Set the preferred keyserver URL for the selected user IDs.
notation
- Set a notation for the selected user IDs.
passwd
- Change the passphrase.
trust
- Change the ownertrust.
revsig
- Revoke signatures on the selected user IDs.
revuid
- Revoke selected user IDs.
revkey
- Revoke key or selected subkeys.
enable
- Enable key.
disable
- Disable key.
showphoto
- Show selected photo IDs.
clean
- Compact unusable user IDs and remove unusable signatures from key.
minimize
- Compact unusable user IDs and remove all signatures from key.