🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

💡 Performance & Debugging March 11, 2026 5

Linux Command: strace

Trace system calls and signals of a process

Terminal — Performance & Debugging
Command
$ strace ls /tmp/
Output
Shows all system calls made by ls.

strace traces system calls and signals received by a process. It shows every interaction between a process and the Linux kernel — file operations, network calls, memory management, and more. strace is the ultimate debugging tool for understanding what a program is actually doing. When a program fails silently, hangs, or behaves unexpectedly, strace reveals the underlying system calls and error codes. strace can attach to running processes or trace new commands. It shows the system call name, arguments, return value, and any errors — making it invaluable for debugging permission issues, missing files, and performance problems.

Syntax

strace [OPTION]... COMMAND

Common Examples

  • strace ls /tmp/ — Shows all system calls made by ls.
  • strace -e openat ./myapp 2>&1 | grep -i "no such file" — Shows files the program tried to open but could not find.
  • sudo strace -p $(pgrep nginx | head -1) -e network — Traces network system calls of a running nginx process.
  • strace -c curl -s https://example.com > /dev/null — Shows a summary of system call counts and time.

Pro Tips

    Master this and 230+ other Linux commands with our comprehensive eBooks and cheat sheets.

    Share this tip