Encrypting to standard output with gnupg

Just in case anyone still needs to do this, you can do it with

gpg -ac -o- infile

Setting the output filename to "-" sends the output to stdout.


Instead of passing the input file to gpg, use shell redirection to send the input file to gpg's stdin, e.g.:

gpg -ac < inputfile

If anybody else needs a better or more concise answer:

You can do gpg --output - with any other flags.

For the example above you can do gpg --armor --symmetric --output - file.txt or gpg -aco - file.txt