How to know the executable file link which lib
时间: 2024-01-14 20:04:23 浏览: 94
raries are linked to in Linux?
You can use the `ldd` command to know the executable file link which libraries are linked to in Linux.
Here’s how to do it:
1. Open a terminal window.
2. Navigate to the directory where the executable file is located.
3. Type the following command: `ldd <executable_file>`
4. Press Enter.
The `ldd` command will list all the shared libraries that the executable file is linked to, along with the file path.
For example, if you want to check the shared libraries linked to the `ls` command, you would type:
```
ldd /bin/ls
```
The output would look something like this:
```
linux-vdso.so.1 => (0x00007ffe97dc6000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f2ee6b84000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2ee67c0000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f2ee657f000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2ee637b000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2ee6ddb000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2ee615e000)
```
This output shows that the `ls` command is linked to several shared libraries, including `libselinux.so.1`, `libc.so.6`, and `libpthread.so.0`.
阅读全文