strace?
下面的例子。启动一个 cat 进程,该进程读取 stdin 并写入 /tmp/foofile。找到 pid,跟踪它。在原来的猫窗口中,输入一些文本,嘿,快点。
# cat >/tmp/foofile
# ps -ef|grep cat
steve 2134 1801 0 22:25 pts/2 00:00:00 cat
# strace -fp 2134
Process 2134 attached
read(0, "test\n", 65536) = 5
write(1, "test\n", 5) = 5
read(0,
Run Code Online (Sandbox Code Playgroud)
要从文件描述符 0 中取出读取内容:
strace -fp 2134 -e trace=read -o "|grep read.0,"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1758 次 |
| 最近记录: |