strace Cheat Sheet
Trace system calls — see every open/read/write a process makes and find the syscall that hangs.
Troubleshooting3 sections · 18 commands
⌘K
Attaching & Basic
6strace CMDTrace a new process
strace -p PIDAttach to a running process
strace -p PID -o trace.logWrite output to a file
strace -T CMDAdd per-syscall timing
strace -tt CMDMicrosecond timestamps
timeout 10 strace -p PIDTrace for 10 seconds then stop
Syscall Filters
6strace -e trace=network CMDOnly network syscalls
strace -e trace=file CMDFile opens and I/O
strace -e trace=read,write CMDSpecific syscalls
strace -e fault=openat:error=EACCES CMDInject an error (testing)
strace -e trace=process CMDProcess lifecycle calls
strace -e signal CMDOnly signal delivery
Children & Summation
6strace -f CMDFollow forks and children
strace -ff -o out CMDOne file per process
strace -c CMDSummary of count/time per syscall
strace -c -f CMDSummary across the whole tree
strace -f -e trace=openat CMD 2>&1 | grep ENOENTWhich file could not be opened
strace -f -e trace=connect CMDConnection attempts only