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?

Was it helpful?

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top