- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to show all shared libraries used by executables in Linux?
We know that a shared library is a library that can be linked to any program at runtime. In order to view all the shared libraries used by an executable we make use of the Linux command utility known as ldd. We can easily locate the shared libraries on a Linux machine, as they usually start with lib* prefix.
Let’s first understand and see examples of how to make use of the ldd command that Linux provides us with.
Ldd is a command utility that Linux provides us with and is mostly used in case we want to know the shared library dependencies of an executable or even that of a shared library.
LDD Syntax
ldd [OPTION] .. FILE ..
The [OPTION] placeholder in the above command can be replaced by the flags that the ldd command provides us with, some of the most common ones are −
-v − Print all information
-d − Processes data relocation
-u − Used to print unused direct dependencies
-r − Processes data and function relocation
Now that we know a little bit about the ldd command, let’s explore a few examples of it where we will display dependencies of an executable and much more.
Example 1
Command
ldd /bin/cp
In the above command we are running the ldd command on the executable named cp stored inside the /bin folder on your linux directory.
Output
linux-vdso.so.1 => (0x00007fffaf3ff000) libselinux.so => /lib64/libselinux.so (0x0000003a06a00000) librt.so => /lib64/librt.so (0x0000003a06200000) libacl.so.1 => /lib64/libacl.so (0x0000003a13000000) libattr.so.1 => /lib64/libattr.so (0x0000003a0ea00000) libc.so.3 => /lib64/libc.so.3 (0x0000003a05200000) libdl.so.2 => /lib64/libdl.so.2 (0x0000003a05a00000) /lib64/ld-linux-x86-64.so.2 (0x0000003a04a00000) libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003a05600000)
We can also display the unused direct dependencies of an executable with the help of the command shown in the example below
Example 2
Command
ldd -u /bin/cp
Output
Unused direct dependencies: /lib64/libselinux.so.1 /lib64/librt.so.1 /lib64/libacl.so.1 /lib64/libattr.so.1
- Related Articles
- How to Create a Shared Directory for All Users in Linux?
- Difference between Static and Shared libraries
- How to run Linux libraries on Docker on Windows?
- How to create standalone Lua executables?
- Python libraries to be used for visualization
- Explain how Python data analysis libraries are used?
- What are the Python libraries that are used by data scientists?
- How to Show Asterisks While Typing Sudo Password in Linux?
- How to list all users in a Linux group?
- How to unzip all zipped files in a Linux directory?
- How to show historical and statistical running time of linux systems
- How should strace be used on Linux?
- How to List All Connected SSH Sessions on Linux
- How to Kill a Process by Name in Linux?
- How to include libraries in Visual Studio 2012?
