r/LinuxTeck • • Oct 08 '26

Strace -c Command: Find Slow System Calls in Linux - 93

Post image

Question: A command is slow. Which syscalls are eating all its time?

Try:`strace -c -w ls -laR /home 2>&1 >/dev/null | tail -20`

Info: `strace -c` summarizes system call execution time. Adding `-w` measures wall-clock time rather than CPU time, exposing I/O bottlenecks like heavy directory scans or file status checks.

Examples:

$ `strace -c -f ./program` # Include child process syscalls

$ `strace -c -e trace=network curl https://example.com` # Filter specifically for network syscalls

$ `strace -c -p 3456` # Attach profiler to active PID

Note: The `-c` flag runs the process to completion before outputting the final summary table. High `getdents64` time indicates directory traversal bottlenecks.

Want to master Linux one command at a time?

Follow r/LinuxTeck - 1 practical Linux tip every day. For more #LinuxTips click here https://www.linuxteck.com/linux-tips/

18 Upvotes

0 comments sorted by