Question

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?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top