まずは秘密鍵と公開鍵を表示。
$ gpg --list-public-keys && gpg --list-secret-keys
秘密鍵と公開鍵を両方共削除する。
$ gpg --no-greeting --delete-secret-and-public-keys $(gpg --with-colons --list-public-keys | awk -F: '$1 ~ /^pub$/{ print $5 }'); sec 4096R/1E708295 2015-12-30 hoge fuga <hoge@example.com> Delete this key from the keyring? (y/N) y This is a secret key! - really delete? (y/N) y pub 4096R/1E708295 2015-12-30 hoge fuga <hoge@example.com> Delete this key from the keyring? (y/N) y
$ gpg --delete-secret-keys $(gpg --with-colons --list-secret-keys | awk -F: '$1 ~ /^sec$/{ print $5 }'); $ gpg --delete-keys $(gpg --with-colons --list-public-keys | awk -F: '$1 ~ /^pub$/{ print $5 }');