Unix / Linux: How to Print Shared Library Dependencies

Almost all programs on UNIX and/or Linux use shared libraries. Only some programs, like the root shell, /sbin/sh, on old versions of Solaris, used to be statically linked. It is no longer the case for the current Solaris releases. It was mainly due to historical reasons when disks used to be small in size (usually 128MB or less in size) and the shared libraries in /usr/lib were mounted from a second disk or NFS server. If you boot a server into single-user mode, it may not mount partitions other than the root partition, thereby breaking any dynamically linked program.

The ldd porgram can be used to display shared libraries used a by program, along with the path of the shared libaries.

The following program shows the dependencies of the ls program on Ubuntu.

If the program’s path is defined in the $PATH environment variable, then you do not need to specify the full path of the program. You will just need to extract the path by running the which utility within backticks. This will cause the command within the backticks to be evaluated and the output will be passed to the ldd command.

ibrahim = { interested_in(unix, linux, android, open_source, reverse_engineering); coding(c, shell, php, python, java, javascript, nodejs, react); plays_on(xbox, ps4); linux_desktop_user(true); }