Skip to content

Linux strace Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

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

  1. strace Installation
  2. strace Basics
  3. Tracing System Calls
  4. Filtering
  5. Troubleshooting

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


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally