Trace a new process strace
Run a command under strace and save output to file
strace -o trace.log ls /tmp
more strace
all 13 commands →
Attach to running process
strace -p $(pgrep nginx | head -1) -o /tmp/nginx.trace
Trace only specific syscalls
strace -e trace=openat,read,write curl https://example.com
Count syscall statistics
strace -c -e trace=all python3 app.py
Follow child processes
strace -f -e trace=process nginx -t
Show timestamps
strace -tt -T curl https://example.com 2>&1 | head -40