如何排除strace中的一些调用?

How to exclude some calls in strace?

我想用strace 跟踪系统调用。 read和write太多了,想排除掉

这是我的测试:

strace -e trace=!read ls

我的电脑 (Ubuntu 14) 未能 运行 此命令。错误消息是 !open: event not found。仔细看了man,不明白为什么会失败

您的 shell 将 ! 解释为特殊符号,因此无法 运行 命令。使用引号:

strace -e 'trace=!read' ls

或使用\转义:

strace -e trace=\!read ls