How To Use Linux ldd Command To Print Shared Libraries with Examples?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-use-linux-ldd-command-to-print-shared-libraries-with-examples/
PINTEREST
PINTEREST
INSTAGRAM

Shared libraries are used to provide functions to the commands and executable of the Linux. ldd command can be used to list currently used shared libraries of given executable file.

Help

Even ldd command is a simple command which provide some parameters this can be listed with the --help option like below.

ldd Help
ldd Help

Print Given Executable Shared Libraries

We will start with the basic usage where we will print given executable file shared libraries. In this example we will use echo executable.

Print Given Executable Shared Libraries
Print Given Executable Shared Libraries

We can see that libraries like linux-vdso,libc.so and ld-linux-x86-64.so are used by the echo binary. There is also the full path of the given libraries where they are generally resides in /lib or /lib64 directories.

Print All Information

We can print more detailed information about the given executable. We will use -v option where we will print all information like versin and alternative libraries about given executable.

Print All Information
Print All Information

Print Data Relocations

We can also print the data relocations about the given libraries with the -d option.

Print Data Relocations
Print Data Relocations

Relocations are the memory addresses of the given part of the library.

Print Function Relocations

We can also print the function relocations of the given executable file with the -r option.

Print Function Relocations
Print Function Relocations

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-use-linux-ldd-command-to-print-shared-libraries-with-examples/
PINTEREST
PINTEREST
INSTAGRAM
LEARN MORE  How To Compile C and C++ Applications with GCC?