Skip to content

Linux ltrace Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux ltrace Guide

Complete beginner-friendly guide to ltrace on Linux, covering Arch Linux, CachyOS, and other distributions including library call tracing, function calls, and debugging.


Table of Contents

  1. ltrace Installation
  2. ltrace Basics
  3. Tracing Library Calls
  4. Filtering
  5. Troubleshooting

ltrace Installation

Install ltrace

Arch/CachyOS:

# Install ltrace
sudo pacman -S ltrace

Debian/Ubuntu:

sudo apt install ltrace

Fedora:

sudo dnf install ltrace

ltrace Basics

Trace Command

Basic usage:

# Trace command
ltrace ls

# Shows library function calls

Trace Process

Running process:

# Trace running process
ltrace -p PID

# -p = PID (traces process by PID)

Tracing Library Calls

Library Functions

View calls:

# Show library calls
ltrace ls

# Shows:
# - printf()
# - malloc()
# - strcmp()
# - etc.

Summary

Statistics:

# Summary statistics
ltrace -c ls

# -c = count (shows summary)

Filtering

Filter Functions

Specific functions:

# Filter functions
ltrace -e malloc ls

# -e = trace (only malloc() calls)

Multiple Filters

Multiple functions:

# Multiple filters
ltrace -e malloc,free ls

# Traces multiple functions

Troubleshooting

ltrace Not Found

Check installation:

# Check ltrace
which ltrace

# Install if missing
sudo pacman -S ltrace

Summary

This guide covered ltrace usage, library 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