Linux Terminal Command: ltrace

The ltrace command is an essential tool in System Information & Hardware. In this tutorial, we will explore what ltrace does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.


Concept & Explanation

The ltrace command intercepts and records dynamic library calls called by a running user-space process.


Common Options & Syntax

ltrace [options] [arguments]

Here are the most common flags used with ltrace:


1. Interactive Example (Simple)

Here is how most people run the command:

# Example
ltrace ./app

What it does: Logs library calls executed by the binary ‘./app’.


2. Power-User Example (Advanced)

For scripting and advanced diagnostics, use this configuration:

# Advanced
ltrace -c -p 1234

What it does: Attaches to running process 1234, tracks calls, and prints a summary report showing call count and execution times when detached.


⚙️ Warning & Common Pitfalls

[!WARNING] ltrace will not track statically linked library functions, as they are compiled directly inside the binary rather than called dynamically.


Here are some related posts on cli_tty1 you might want to check out: