Attach to running process
Trace syscalls of an already-running process by PID
strace -p $(pgrep nginx | head -1) -o /tmp/nginx.trace
- tool
- strace13 commands
More strace commands
-
strace -e trace=openat,read,write curl https://example.comFilter to file-related syscalls only
-
strace -c -e trace=all python3 app.pySummary table of syscall counts and time spent
-
strace -f -e trace=process nginx -tTrace syscalls in all forked children (-f)
-
strace -tt -T curl https://example.com 2>&1 | head -40-tt adds absolute time; -T shows time spent in each call
-
strace -e trace=openat -e trace=file myapp 2>&1 | grep 'ENOENT'Find files the process tries to open but cannot find