Table of Contents
There is no way to pipe only stderr. If want to pipe stderr, stdin has to go through too:
prog 2>&1 | prog2
documented on: 2005.05.25
As explained before, if you want to pipe stderr the standard way, stdin has to go through too.
However, if you really want to pipe only stderr through, without stdin messing up the content, this is how:
$ ls -d . no ls: no: No such file or directory . ls -d . no 2>&1 > log1 | cat > log2 $ cat log1 . $ cat log2 ls: no: No such file or directory
I.e., the file log2 contains output only from the stderr of the first command.
documented on: 2007.04.03