strace

Trace system calls and signals made by a process.

low risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
What it does

strace intercepts and logs every system call (open, read, write, socket, etc.) made by a process. The go-to tool for debugging 'permission denied' errors, missing files, and mysterious failures — shows exactly what the kernel sees.

Common flags
FlagMeaning
-p --attachAttach to an already-running process by PID
-e --exprFilter to specific system calls
-f --follow-forksFollow child processes
-o --outputWrite output to file instead of stderr
-c --summaryPrint summary statistics only
-t --timestampPrefix each line with timestamp
Examples
strace -p $(pgrep nginx) -e trace=networkTrace network calls of running nginx · explain & risk-check →
strace -f -e openat ls /tmp 2>&1 | grep ENOENTFind missing files a command tries to open · explain & risk-check →
strace -c -p 1234Get syscall frequency summary for PID 1234 · explain & risk-check →
strace -o /tmp/trace.txt myappRun app and log all syscalls to file · explain & risk-check →
Pro tip

Use `strace -e trace=openat,read,write` to narrow output — full strace output is overwhelming; filtering to file I/O syscalls finds 80% of 'permission denied' bugs fast.

Related
lsof ps dmesg
Open the full explainer →More in Debugging & Performance

Reference text is hand-written and may be incomplete — check man strace for your version. Test destructive commands on a non-production system first.