strace shows every system call a process makes. It's the ultimate debugging tool when you need to see what a program is actually doing.
February 25, 2026 · 7 min · 1297 words · Rob Washington
Table of Contents
strace intercepts and records system calls made by a process. When a program hangs, crashes, or behaves mysteriously, strace reveals what it’s actually doing at the kernel level.
# Write to filestrace -o output.txt ls
# Append to filestrace -o output.txt -A ls
# With timestamps (wall clock)strace -t ls
# With microsecondsstrace -tt ls
# Relative timestampsstrace -r ls
# Show full strings (default truncates at 32 chars)strace -s 1000 cat file.txt
# Show full strings for specific callsstrace -e read -s 10000 cat file.txt
# Attach to hung processstrace -p $(pgrep hung-process)# Common findings:# - Waiting on read() = blocked on input# - Waiting on futex() = waiting for lock# - Waiting on poll/select = waiting for I/O
# Time each syscallstrace -T ls
# Shows time spent in each call:# openat(AT_FDCWD, ".", ...) = 3 <0.000015># Summary to find slow operationsstrace -c -S time slow-program
strace is the “X-ray vision” for Linux debugging. When logs don’t help and documentation is wrong, strace shows you exactly what a program is doing. It’s invasive and slow, so use it for debugging rather than production monitoring, but when you need it, nothing else comes close.
📬 Get the Newsletter
Weekly insights on DevOps, automation, and CLI mastery. No spam, unsubscribe anytime.