Linux strace Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux strace Guide
Complete beginner-friendly guide to strace on Linux, covering Arch Linux, CachyOS, and other distributions including system call tracing, debugging, and process monitoring.
Table of Contents
strace Installation
Install strace
Arch/CachyOS:
# Install strace
sudo pacman -S strace
Debian/Ubuntu:
sudo apt install strace
Fedora:
sudo dnf install strace
strace Basics
Trace Command
Basic usage:
# Trace command
strace ls
# Shows all system calls
Trace Process
Running process:
# Trace running process
strace -p PID
# -p = PID (traces process by PID)
Tracing System Calls
System Calls
View calls:
# Show system calls
strace ls
# Shows:
# - open()
# - read()
# - write()
# - close()
# etc.
Summary
Statistics:
# Summary statistics
strace -c ls
# -c = count (shows summary)
Filtering
Filter Calls
Specific calls:
# Filter system calls
strace -e open ls
# -e = trace (only open() calls)
Multiple Filters
Multiple calls:
# Multiple filters
strace -e open,read,write ls
# Traces multiple call types
Troubleshooting
strace Not Found
Check installation:
# Check strace
which strace
# Install if missing
sudo pacman -S strace
Summary
This guide covered strace usage, system call tracing, and debugging for Arch Linux, CachyOS, and other distributions.
Next Steps
- ltrace Guide - Library call tracing
- Process Management - Process monitoring
- Debugging - Debugging tools
- strace Documentation:
man strace
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.