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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top