Linux command
peekfd 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Watch all file descriptors of a process
peekfd [pid]
Watch a specific file descriptor (e.g. stdout=1)
peekfd [pid] [1]
Remove duplicate read/write output (useful for terminals with echo)
peekfd -d [pid]
Suppress per-chunk headers
peekfd -n [pid]
Follow newly created child processes
peekfd -c [pid]
8-bit clean output (no post-processing of bytes)
peekfd -8 [pid]
说明
peekfd attaches to a running process using ptrace and prints the bytes it reads from and writes to the specified file descriptors. It can be used to spy on stdin/stdout/stderr or on arbitrary open files and sockets without restarting the process. By default every tracked fd is shown, with a header preceding each chunk of data that identifies the pid and fd. The -8, -n, -d, and -c flags tune formatting and child-process handling.
参数
- -8, --eight-bit-clean
- Do no post-processing on the bytes being read or written. Output is raw binary.
- -n, --no-headers
- Do not display headers that indicate the source (pid/fd) of the dumped bytes.
- -c, --follow
- Also dump file-descriptor activity in any child processes created by the target.
- -d, --duplicates-removed
- Remove duplicate read/writes from the output. Useful when watching a terminal with local echo enabled.
- -V, --version
- Display version information.
- -h, --help
- Display help information.
FAQ
What is the peekfd command used for?
peekfd attaches to a running process using ptrace and prints the bytes it reads from and writes to the specified file descriptors. It can be used to spy on stdin/stdout/stderr or on arbitrary open files and sockets without restarting the process. By default every tracked fd is shown, with a header preceding each chunk of data that identifies the pid and fd. The -8, -n, -d, and -c flags tune formatting and child-process handling.
How do I run a basic peekfd example?
Run `peekfd [pid]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -8, --eight-bit-clean do in peekfd?
Do no post-processing on the bytes being read or written. Output is raw binary.