save a file with gpg public key code example
Example 1: How to export a GPG public key to a file
gpg --output public.pgp --armor --export username@email
Example 2: How to export a GPG private key to a file
gpg --output private.pgp --armor --export-secret-key username@email