Using the ‘ldd’ command on Linux

Using the 'ldd' command on Linux

Find the software library used by your program

Use the LDD command to show the shared library that is needed by any program. LDD commands are useful for working when there is a missing dependency. This command also lists missing functions and objects.

LDD Syntax Commands

Note the correct syntax for LDD commands to avoid errors:

ldd [OPTION]... FILE...

Use one or more of the available ldd command switches, pasted to [OPTION] in the above command:

–help: Print this help and exit.
– version: Print version information and exit.
-d, –data-relocs: Processing data relocation.
-r, –function-relocs: Processing data and relocation functions.
-u, –unused: Print direct dependencies that are not used.
-v, –verbose: Print all information.

How to Use LDD Commands

Run the following command to get more information about a program:

ldd -v /path/to/program/executable

The output shows version information as well as the path and address to the shared library, like this: => (0x00007fff26ac8000) => /lib/ 0x00007ff1df55a000)
/lib64/ (0x00007ff1dfafe000)


If the SO file does not exist at all, you can find the missing library using the following command:

ldd -d path/to/program

The output is similar to the following: (0x00007ffc2936b000)
/home/gary/demo/ => not => usr/lib/ (0x00007fd0c6259000)
/lib64/ (0x00007fd0c65fd000)


Never run the ldd command against a program that is not trusted because the ldd command might run it. Instead, use safer alternatives that only show direct dependencies and not all dependency trees:

objdump -p /path/to/program | grep NEEDED


How to find your way to the application

You must provide the full path to the application if you want to find dependencies with LDD, which you can do in several ways.

For example, this is how to find a path to Firefox:

find / -name firefox

The problem with the find command, however, is that it lists executables and wherever Firefox is, like this:


This approach is a bit of an overkill and you may need to use the sudo command to elevate your privileges, else you’re likely to get man permission-denied errors.

It’s instead easier to use the whereis command to find an application’s path:

whereis firefox

This time the results might look like this:



Then, to find a shared library for Firefox, enter the following command:

ldd /usr/bin/firefox

The output from the command will be like this: (0x00007ffff8364000) => /usr/lib/ (0x00007feb9917a000) => /usr/lib/ (0x00007feb98f76000) => /usr/lib/ (0x00007feb98bf4000) => /usr/lib/ (0x00007feb988f6000) => /usr/lib/ (0x00007feb986e0000) => /usr/lib/ (0x00007feb9833c000)
/lib64/ (0x00007feb99397000) is the name of the library and the hex number is the address where the library is loaded into memory.

On many lines, the symbol => is followed by the path. This is the path to physical binary. The hex number is the address where the library is loaded.

Related posts

How to use the classic Unity Desktop on Ubuntu 20.04


How to Check Memory Usage on Linux


How to Install Python Pip on Ubuntu 20.04


How to Get Windows Terminal Fonts (Cascadia Code) on an Ubuntu Terminal


How to Run a Cron Job Every 5, 10 or 15 Minutes


How to Install the NoSQL Apache CouchDB Database on CentOS 8


How to Overcome Python & AI with this Extensive Training Package


How to Install Ruby on Ubuntu 20.04


How to Add Elements to a List in Python (add, add and enter)