101-500日本語試験無料問題集「Lpi LPIC-1 Exam 101, Part 1 of 2, version 5.0 (101-500日本語版) 認定」
バイナリ実行可能ファイルまたは別の共有ライブラリに必要なすべての共有ライブラリを表示するコマンドはどれですか?
(パスまたはパラメーターなしでコマンドのみを指定します。)
(パスまたはパラメーターなしでコマンドのみを指定します。)
正解:
ldd
Explanation
The command that shows all shared libraries required by a binary executable or another shared library is ldd.
This command queries the dynamic linker to find out which libraries are needed by the given file and displays them on the standard output. For example, to see the shared libraries required by the /bin/ls program, we can run:
ldd /bin/ls
The output will look something like this:
linux-vdso.so.1 (0x00007ffd8a7f6000)libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f0c5a6c4000)libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0c5a4d3000)libpcre2-8.so.0 =>
/usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f0c5a445000)libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0c5a441000)/lib64/ld-linux-x86-64.so.2 (0x00007f0c5a8a5000)libpthread.so.0 =>
/lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0c5a41e000)
The output shows the name and the path of each shared library, as well as the address where it is loaded in memory. If the library is not found, the output will show not found instead of the path. The linux-vdso.so.1 library is a special case, as it is a virtual library that is not actually present on the filesystem, but is injected by the kernel into every process12.
References:
* How to Show All Shared Libraries Used by Executables in Linux? - Baeldung
* How to show all shared libraries used by executables in Linux? - Stack Overflow
Explanation
The command that shows all shared libraries required by a binary executable or another shared library is ldd.
This command queries the dynamic linker to find out which libraries are needed by the given file and displays them on the standard output. For example, to see the shared libraries required by the /bin/ls program, we can run:
ldd /bin/ls
The output will look something like this:
linux-vdso.so.1 (0x00007ffd8a7f6000)libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f0c5a6c4000)libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0c5a4d3000)libpcre2-8.so.0 =>
/usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f0c5a445000)libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0c5a441000)/lib64/ld-linux-x86-64.so.2 (0x00007f0c5a8a5000)libpthread.so.0 =>
/lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0c5a41e000)
The output shows the name and the path of each shared library, as well as the address where it is loaded in memory. If the library is not found, the output will show not found instead of the path. The linux-vdso.so.1 library is a special case, as it is a virtual library that is not actually present on the filesystem, but is injected by the kernel into every process12.
References:
* How to Show All Shared Libraries Used by Executables in Linux? - Baeldung
* How to show all shared libraries used by executables in Linux? - Stack Overflow