GPG

# list private keys
> gpg --list-secret-keys
> gpg -K

# list public keys
> gpg --list-keys
> gpg -k

# generate keypair
> gpg --full-generate-key # > 1 > 4096 > 1y > ... > strongpassword

# show fingerprint
> gpg --fingerprint <KEY_ID>

# export public key to file
> gpg -a --output gpg-key.asc --export <KEY_ID>

# create an revoke certificate
> gpg --output revoke_ident.asc --gen-revoke <KEY_ID>

# revoke a certificate
> gpg --gen-revoke <KEY_ID> > {1,2,3}

# import public key from file
> gpg --import /path/to/gpg-key.asc

# sign imported public key
> gpg --sign-key <KEY_ID>

# delete a private key
> gpg --delete-secret-keys <KEY_ID>

# delete a public key
> gpg --delete-keys <KEY_ID>

# encrypt files using public key
> gpg --encrypt --sign --armor -r <KEY_ID> /foo/bar

# edit a key interactivly
> gpg --edit-key <KEY_ID>
## to add email alias:
## gpg> adduid
## Real Name: <name>
## Email address: <email>
## Comment: <comment or Return to none>
## Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
## Enter passphrase: <password>
## gpg> uid <uid>
## gpg> trust
## Your decision? 5
## Do you really want to set this key to ultimate trust? (y/N) y
## gpg> save