Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to access my secret GPG/PGP key to copy/paste it into another application.

How do I show my secret key without generating too much traces of it?

I only know of the export command to gpg (or the export function in several GUI-GPG tools), but this would always generate a file. A file on the filesystem needs to be securely erased afterwards, may get picked up by synchronization, backup or mirroring tools etc.

So is there a way to show it in a dialog window (no traces except RAM/swapfile) or at least only to the console window (will leave trace in console history)?

share|improve this question
up vote 1 down vote accepted

Both --export and --export-secret-keys write to stdout (which you can pipe wherever you want) if no file is given.

gpg --export-secret-keys -a [KEYID]

Will output:

Version: GnuPG v1.4.13 (Darwin)
Comment: GPGTools -


(ommit the -a option if you do not want ascii armored output)

share|improve this answer
Thanks! I was to stupid to actually try the --export option on the command line after all the GUI tools only offered file output. – Chaos_99 Aug 14 '13 at 9:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.