Once you have generated your key pair, you need to make sure you back it up safely, to prevent the loss of the keys if the computer crashes or is re-installed.
The reasons the public key is exported to a text file:
1. To make sure the key is stored off the computer somewhere safely.
2. To allow the key to be exported to a key server.
Open a terminal window on your Ubuntu system and enter the following command.
gpg --export --armor email@example.com --output johndoepub.asc <enter>
The public key will be exported to a file
You can also upload this key to any PGP key server. You can also open the
johndoepub.asc file, copy and paste the contents into a key server that displays a text box for your type in the key.