List shared or dynamic libraries required by a program

In Linux, the


is used to find out the shared libraries or dependencies required by a program if it is a dynamic executable. ldd requires the full path to the executable as input.

For instance, the Linux ps command depends on the following shared or dynamic libraries –

[root@kauai rtc0]# ldd $(which ps) =>  (0x00007ffeb6277000) => /lib64/ (0x0000003ef6200000) => /lib64/ (0x0000003ef4e00000) => /lib64/ (0x0000003ef4a00000) => /lib64/ (0x0000003ef5600000)
	/lib64/ (0x0000003ef4600000)

You can also use the ldd command to find out if an executable has an expected dependencies. In this case, we expect that the htpasswd, login and sshd commands depend on the crypt library as they prompt a user for a password for authentication purposes –

[root@kauai rtc0]# ldd $(which htpasswd) |grep crypt => /lib64/ (0x00007f010c8ab000)

[root@kauai rtc0]# ldd $(which login) | grep crypt => /lib64/ (0x0000003efd200000)

[root@kauai rtc0]# ldd $(which sshd) | grep crypt => /usr/lib64/ (0x00007ffb0b1f2000) => /lib64/ (0x00007ffb0a988000) => /lib64/ (0x00007ffb0a015000)

References –

Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *


Post Navigation