cmdxray / commands / strace

What does strace do?

trace the system calls and signals a process makes.

▸ Explain your own strace command →

strace examples, explained

$ strace -f -e trace=open,read -o trace.log ./prog

  • stracetrace the system calls and signals a process makes
  • -falso trace child processes as they are forked
  • -efilter which system calls or events to trace
  • trace=open,readvalue for -e
  • -owrite the trace to a file instead of standard error
  • trace.logvalue for -o
  • ./progan argument passed to the command

$ strace -p 1234 -c

  • stracetrace the system calls and signals a process makes
  • -pattach to and trace an already-running PID
  • 1234value for -p
  • -ccount time, calls and errors per syscall, print a summary

strace flags & options

-falso trace child processes as they are forked
-efilter which system calls or events to trace
-pattach to and trace an already-running PID
-owrite the trace to a file instead of standard error
-ccount time, calls and errors per syscall, print a summary
-tprefix each line with the time of day
-Tshow the time spent inside each system call
-sset the maximum length of printed strings (default 32)
-vverbose — print unabbreviated structs, env, etc.
-yprint paths for file-descriptor arguments

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.