diff --git a/sources/tech/20140807 Linux FAQs with Answers--How to check what libraries are used by a program or process on Linux.md b/sources/tech/20140807 Linux FAQs with Answers--How to check what libraries are used by a program or process on Linux.md deleted file mode 100644 index 777c8523b3..0000000000 --- a/sources/tech/20140807 Linux FAQs with Answers--How to check what libraries are used by a program or process on Linux.md +++ /dev/null @@ -1,45 +0,0 @@ -[translating by KayGuoWhu] -Linux FAQs with Answers--How to check what libraries are used by a program or process on Linux -================================================================================ -> **Question**: I would like to know which shared libraries are loaded at run-time when I invoke a particular executable. Is there any way to identify shared library dependencies of a program executable or a running process on Linux? - -### Check shared library dependencies of a program executable ### - -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. - - $ ldd /path/to/program - -![](https://farm4.staticflickr.com/3872/14846153231_195cfff0f0_z.jpg) - -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. - - $ objdump -p /path/to/program | grep NEEDED - -![](https://farm6.staticflickr.com/5552/14849218545_e3b667e742_o.png) - -Check shared library dependencies of a running process - -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. - - $ sudo pldd - -Note that you need root privilege to run pldd command. - -![](https://farm6.staticflickr.com/5570/14846775694_96a6b96592_z.jpg) - -Alternatively, a command line utility called pmap, which reports memory map of a process, can also show shared library dependencies of a running process. - - $ sudo pmap - -![](https://farm4.staticflickr.com/3919/14848885042_7e5bee2684_z.jpg) - --------------------------------------------------------------------------------- - -via: http://ask.xmodulo.com/check-library-dependency-program-process-linux.html - -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 \ No newline at end of file diff --git a/translated/tech/20140807 Linux FAQs with Answers--How to check what libraries are used by a program or process on Linux.md b/translated/tech/20140807 Linux FAQs with Answers--How to check what libraries are used by a program or process on Linux.md new file mode 100644 index 0000000000..ee05a6ecd4 --- /dev/null +++ b/translated/tech/20140807 Linux FAQs with Answers--How to check what libraries are used by a program or process on Linux.md @@ -0,0 +1,45 @@ +Linux有问必答--如何查看Linux上程序或进程用到的库 +================================================================================ +> **问题**:我想知道当我调用一个特定的可执行文件在运行时载入了哪些共享库。是否有方法可以明确Linux上可执行程序或运行进程的共享库依赖关系? + + +### 查看可执行程序的共享库依赖关系 ### + +要找出某个特定可执行依赖的库,可以使用ldd命令。这个命令调用动态链接器去找到程序的库文件依赖关系。 + + $ ldd /path/to/program + +![](https://farm4.staticflickr.com/3872/14846153231_195cfff0f0_z.jpg) + +注意并不推荐为任何不可信的第三方可执行程序运行ldd,因为某些版本的ldd可能会直接调用可执行程序来明确其库文件依赖关系,这样可能不安全。 + +取而代之的是用一个更安全的方式来显示一个未知应用程序二进制文件的库文件依赖,使用如下命令: + + $ objdump -p /path/to/program | grep NEEDED + +![](https://farm6.staticflickr.com/5552/14849218545_e3b667e742_o.png) + +查看运行进程的共享库依赖关系(注:这里缺少###的标题格式?) + +如果你想要找出被一个运行中的进程载入的共享库,你可以使用pldd命令,它会显示出在运行时被载入一个进程里的所有共享对象。 + + $ sudo pldd + +注意你需要root权限去执行pldd命令。 + +![](https://farm6.staticflickr.com/5570/14846775694_96a6b96592_z.jpg) + +或者,也可以选择一个叫做pmap的命令行工具。它报告一个进程的内存映射,也能显示出运行进程的库文件依赖。 + + $ sudo pmap + +![](https://farm4.staticflickr.com/3919/14848885042_7e5bee2684_z.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/check-library-dependency-program-process-linux.html + +译者:[KayGuoWhu](https://github.com/KayGuoWhu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 \ No newline at end of file