I currently use a script to decrypt a file, but it writes it to disk. I then use wipe to clear it. Is there a way to write it to screen so it never writes it to disk?

I use the command $ echo PASSWORD | gpg file.txt.gpg and it creates a file.txt. Then I use wipe to erase the file. Can I extract it to my screen or tmp file system and use more/less to view it?

I know I can create a script to build a tmp file system, then decrypt to it, then view it under /tmp/ramdisk. I could just delete the tmp/ramdisk, but I was sure there was a program or a method to view it one time only to tmp ram system.

2 Answers 2


By default, gpg -d does not write to disk. It just goes to stdout. You can then pipe that to your viewer of choice:

gpg -d file.txt.gpg | less

Or for vim, disable all of vim's temp file features. Then

gpg -d file.txt.gpg | vim -


All you need is the -d option to gpg:

gpg -d file.txt.gpg
  • How can you pass it to a non-caching viewer like /bin/less ? Dec 6, 2016 at 16:14
  • This will not show the output on a terminal. Sep 6, 2019 at 7:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .