How do i back up my PGP key [duplicate]

From Ubuntu's GPG Howto:

Backing up your public key

  1. List your public keys:

    gpg --list-keys
    
  2. Look for the line that starts something like "pub 1024D/". The part after the 1024D is the key-id. To export the key:

    gpg -ao _something_-public.key --export key-id
    

Backing up your private key

  1. List your private keys:

    gpg --list-secret-keys
    
  2. Look for the line that starts something like "sec 1024D/". The part after the 1024D is the key-id. To export the private key:

    gpg -ao _something_-private.key --export-secret-keys key-id
    

How to restore is also listed there.