{"id":1103,"date":"2018-10-21T08:22:52","date_gmt":"2018-10-21T08:22:52","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=1103"},"modified":"2018-10-23T00:44:16","modified_gmt":"2018-10-23T00:44:16","slug":"how-to-check-which-libraries-are-used-by-a-program-or-process-on-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/21\/how-to-check-which-libraries-are-used-by-a-program-or-process-on-linux\/","title":{"rendered":"How to check which libraries are used by a program or process on Linux ?"},"content":{"rendered":"<p>To find out what libraries a particular executable depends on, you can use ldd command. This command invokes dynamic linker to find out library dependencies of an executable.[ram@linuxforfreshers.com]$ldd \/usr\/bin\/ssh linux-vdso.so.1 =&gt; (0x00007ffe099dc000) libselinux.so.1 =&gt; \/lib\/x86_64-linux-gnu\/libselinux.so.1 (0x00007f578f64a000) libcrypto.so.1.0.0 =&gt; \/lib\/x86_64-linux-gnu\/libcrypto.so.1.0.0 (0x00007f578f26e000) libdl.so.2 =&gt; \/lib\/x86_64-linux-gnu\/libdl.so.2 (0x00007f578f069000) libz.so.1 =&gt; \/lib\/x86_64-linux-gnu\/libz.so.1 (0x00007f578ee50000) libresolv.so.2 =&gt; \/lib\/x86_64-linux-gnu\/libresolv.so.2 (0x00007f578ec35000) libgssapi_krb5.so.2 =&gt; \/usr\/lib\/x86_64-linux-gnu\/libgssapi_krb5.so.2 (0x00007f578e9ed000) libc.so.6 =&gt; \/lib\/x86_64-linux-gnu\/libc.so.6 (0x00007f578e628000) libpcre.so.3 =&gt; \/lib\/x86_64-linux-gnu\/libpcre.so.3 (0x00007f578e3ea000) \/lib64\/ld-linux-x86-64.so.2 (0x000055f5ccd53000) libkrb5.so.3 =&gt; \/usr\/lib\/x86_64-linux-gnu\/libkrb5.so.3 (0x00007f578e11e000) libk5crypto.so.3 =&gt; \/usr\/lib\/x86_64-linux-gnu\/libk5crypto.so.3 (0x00007f578deef000) libcom_err.so.2 =&gt; \/lib\/x86_64-linux-gnu\/libcom_err.so.2 (0x00007f578dceb000) libkrb5support.so.0 =&gt; \/usr\/lib\/x86_64-linux-gnu\/libkrb5support.so.0 (0x00007f578dadf000) libkeyutils.so.1 =&gt; \/lib\/x86_64-linux-gnu\/libkeyutils.so.1 (0x00007f578d8db000) libpthread.so.0 =&gt; \/lib\/x86_64-linux-gnu\/libpthread.so.0 (0x00007f578d6bc000)Note that it is NOT recommended to run ldd with any untrusted third-party executable because some versions of ldd may directly invoke the executable to identify its library dependencies, which can be security risk.Instead, a safer way to show library dependencies of an unknown application binary is to use the following command.<b>objdump -p \/path\/to\/program <\/b>[ram@linuxforfreshers.com]$objdump -p \/usr\/bin\/ssh | grep NEEDED NEEDED libselinux.so.1 NEEDED libcrypto.so.1.0.0 NEEDED libdl.so.2 NEEDED libz.so.1 NEEDED libresolv.so.2 NEEDED libgssapi_krb5.so.2 NEEDED libc.so.6<\/p>\n<h2><b>Check shared library dependencies of a running process<\/b><\/h2>\n<p>If you want to find out what shared libraries are loaded by a running process, you can use pldd command, which shows all shared objects loaded into a process at run-time.<b> <\/b><b>lsof -P -T -p Application_PID<\/b><\/p>\n<p><a href=\"https:\/\/www.linuxforfreshers.com\/2017\/10\/how-to-check-which-libraries-are-used.html\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To find out what libraries a particular executable depends on, you can use ldd command. This command invokes dynamic linker to find out library dependencies of an executable.[ram@linuxforfreshers.com]$ldd \/usr\/bin\/ssh linux-vdso.so.1 =&gt; (0x00007ffe099dc000) libselinux.so.1 =&gt; \/lib\/x86_64-linux-gnu\/libselinux.so.1 (0x00007f578f64a000) libcrypto.so.1.0.0 =&gt; \/lib\/x86_64-linux-gnu\/libcrypto.so.1.0.0 (0x00007f578f26e000) libdl.so.2 =&gt; \/lib\/x86_64-linux-gnu\/libdl.so.2 (0x00007f578f069000) libz.so.1 =&gt; \/lib\/x86_64-linux-gnu\/libz.so.1 (0x00007f578ee50000) libresolv.so.2 =&gt; \/lib\/x86_64-linux-gnu\/libresolv.so.2 (0x00007f578ec35000) libgssapi_krb5.so.2 =&gt; \/usr\/lib\/x86_64-linux-gnu\/libgssapi_krb5.so.2 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/21\/how-to-check-which-libraries-are-used-by-a-program-or-process-on-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to check which libraries are used by a program or process on Linux ?&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1103","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=1103"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1103\/revisions"}],"predecessor-version":[{"id":1341,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1103\/revisions\/1341"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=1103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=1103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=1103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}