Frage

when i do:

sudo strace -p PID 2>&1 | grep -v "recvmsg"

grep matches the lines it ought to match, but when i do:

sudo strace -p PID|grep -v "recvmsg"

It still shows all calls. Why is that?

War es hilfreich?

Lösung

This is because strace writes all its output to stderr, not stdout. And a pipe redirects stdout, not stderr. So you need to redirect stderr of strace to stdout before piping to grep.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top