How to export GPG public key to file using the command line

gpg_export_example.sh
gpg --armor -o MyKey.gpg --export [Key ID or fingerprint]

For example, with fingerprint

gpg_export_fingerprint.sh
gpg --armor -o MyKey.gpg --export AA15942077B73AE65E88FB4BCFC41606DD8C212E

with (short) key ID:

gpg_export_keyid.sh
gpg --armor -o MyKey.gpg --export DD8C212E

Check out similar posts by category: Cryptography