• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

ltrace: command not found

by Deepika

The ltrace command can be used to intercept and record the dynamic calls made to shared libraries. The amount of output generated by the ltrace command can be overwhelming for some commands (especially if the -S option is used to also show system calls). You can focus the output to just the interaction between the program and some list of libraries. For example, to execute the id -Z command and show the calls made to the libselinux.so module, execute:

$ ltrace -l /lib/libselinux.so.1 id -Z
is_selinux_enabled(0xc1c7a0, 0x9f291e8, 0xc1affc, 0, -1)a
       =1	
getcon(0x804c2c8, 0xfee80ff4, 0x804b179, 0x804c020, 0)a
       =0
user_u:system_r:unconfined_t

Remember that you can see what libraries a program is linked against using the ldd command.

If you encounter the below error while running the command ltrace:

ltrace: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install ltrace
Ubuntu apt-get install ltrace
Alpine apk add ltrace
Arch Linux pacman -S ltrace
Kali Linux apt-get install ltrace
CentOS yum install ltrace
Fedora dnf install ltrace
Raspbian apt-get install ltrace

ltrace Command Examples

1. Print (trace) library calls of a program binary:

# ltrace ./program

2. Count library calls. Print a handy summary at the bottom:

# ltrace -c path/to/program

3. Trace calls to malloc and free, omit those done by libc:

# ltrace -e malloc+free-@libc.so* path/to/program

4. Write to file instead of terminal:

# ltrace -o file path/to/program

Filed Under: Linux

Some more articles you might also be interested in …

  1. uptime: command not found
  2. Mac Terminal vi[m] Editor Commands
  3. encfs: Mounts or creates encrypted virtual filesystems
  4. apparmor_status: command not found
  5. kcat Command Examples
  6. How to recover deleted Logical volume (LV) in LVM using vgcfgrestore
  7. How to uninstall python3-gi software package in Ubuntu
  8. CentOS / RHEL 6 : How to Change the Volume Group Name for Root Disk Device
  9. UbuntuDDE new upcoming Linux distribution
  10. How to merge 2 volume groups (VGs) into one using vgmerge in LVM

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright