{"id":52312,"date":"2024-12-03T11:22:05","date_gmt":"2024-12-03T03:22:05","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52312\/"},"modified":"2024-12-03T11:22:05","modified_gmt":"2024-12-03T03:22:05","slug":"linux%e4%b8%adlib%e6%8c%87%e7%9a%84%e6%98%af%e4%bb%80%e4%b9%88","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52312\/","title":{"rendered":"linux\u4e2dlib\u6307\u7684\u662f\u4ec0\u4e48"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>linux\u4e2dlib\u6307\u7684\u662f\u4ec0\u4e48<\/h1>\n<p>\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u5206\u4eab\u300alinux\u4e2dlib\u6307\u7684\u662f\u4ec0\u4e48\u300b\uff0c\u8986\u76d6\u4e86\u6587\u7ae0\u7684\u5e38\u89c1\u57fa\u7840\u77e5\u8bc6\uff0c\u5176\u5b9e\u4e00\u4e2a\u8bed\u8a00\u7684\u5168\u90e8\u77e5\u8bc6\u70b9\u4e00\u7bc7\u6587\u7ae0\u662f\u4e0d\u53ef\u80fd\u8bf4\u5b8c\u7684\uff0c\u4f46\u5e0c\u671b\u901a\u8fc7\u8fd9\u4e9b\u95ee\u9898\uff0c\u8ba9\u8bfb\u8005\u5bf9\u81ea\u5df1\u7684\u638c\u63e1\u7a0b\u5ea6\u6709\u4e00\u5b9a\u7684\u8ba4\u8bc6(B \u6570)\uff0c\u4ece\u800c\u5f25\u8865\u81ea\u5df1\u7684\u4e0d\u8db3\uff0c\u66f4\u597d\u7684\u638c\u63e1\u5b83\u3002<\/p>\n<\/p>\n<blockquote>\n<p>\u5728linux\u4e2d\uff0clib\u662f\u5e93\u6587\u4ef6\u76ee\u5f55\uff0c\u5305\u542b\u4e86\u6240\u6709\u5bf9\u7cfb\u7edf\u6709\u7528\u7684\u5e93\u6587\u4ef6\uff1b\u5e93\u6587\u4ef6\u662f\u5e94\u7528\u7a0b\u5e8f\u3001\u547d\u4ee4\u6216\u8fdb\u7a0b\u6b63\u786e\u6267\u884c\u6240\u9700\u8981\u7684\u6587\u4ef6\u3002lib\u7684\u4f5c\u7528\u7c7b\u4f3c\u4e8eWindows\u91cc\u7684DLL\u6587\u4ef6\uff0c\u51e0\u4e4e\u6240\u6709\u7684\u5e94\u7528\u7a0b\u5e8f\u90fd\u9700\u8981\u7528\u5230lib\u76ee\u5f55\u91cc\u7684\u5171\u4eab\u5e93\u6587\u4ef6\u3002<\/p>\n<\/blockquote>\n<p>lib \u662f Library(\u5e93) \u7684\u7f29\u5199\u8fd9\u4e2a\u76ee\u5f55\u91cc\u5b58\u653e\u7740\u7cfb\u7edf\u6700\u57fa\u672c\u7684\u52a8\u6001\u8fde\u63a5\u5171\u4eab\u5e93\uff0c\u5176\u4f5c\u7528\u7c7b\u4f3c\u4e8e Windows \u91cc\u7684 DLL \u6587\u4ef6\u3002\u51e0\u4e4e\u6240\u6709\u7684\u5e94\u7528\u7a0b\u5e8f\u90fd\u9700\u8981\u7528\u5230\u8fd9\u4e9b\u5171\u4eab\u5e93\u3002<\/p>\n<p><code>\/lib<\/code> \u6587\u4ef6\u5939\u662f \u5e93\u6587\u4ef6\u76ee\u5f55 \uff0c\u5305\u542b\u4e86\u6240\u6709\u5bf9\u7cfb\u7edf\u6709\u7528\u7684\u5e93\u6587\u4ef6\u3002\u7b80\u5355\u6765\u8bf4\uff0c\u5b83\u662f\u5e94\u7528\u7a0b\u5e8f\u3001\u547d\u4ee4\u6216\u8fdb\u7a0b\u6b63\u786e\u6267\u884c\u6240\u9700\u8981\u7684\u6587\u4ef6\u3002\u5728 <code>\/bin<\/code> \u6216 <code>\/sbin<\/code> \u76ee\u5f55\u4e2d\u7684\u547d\u4ee4\u7684\u52a8\u6001\u5e93\u6587\u4ef6\u6b63\u662f\u5728\u6b64\u76ee\u5f55\u4e2d\u3002\u5185\u6838\u6a21\u5757\u540c\u6837\u4e5f\u5728\u8fd9\u91cc\u3002<\/p>\n<p>\u4ee5 pwd \u547d\u4ee4\u6267\u884c\u4e3a\u4f8b\u3002\u6267\u884c\u5b83\u9700\u8981\u8c03\u7528\u4e00\u4e9b\u5e93\u6587\u4ef6\u3002\u8ba9\u6211\u4eec\u6765\u63a2\u7d22\u4e00\u4e0b pwd \u547d\u4ee4\u6267\u884c\u65f6\u90fd\u53d1\u751f\u4e86\u4ec0\u4e48\u3002\u6211\u4eec\u9700\u8981\u4f7f\u7528 strace \u547d\u4ee4 \u627e\u51fa\u8c03\u7528\u7684\u5e93\u6587\u4ef6\u3002<\/p>\n<p>\u793a\u4f8b\uff1a<\/p>\n<pre>root@linuxnix:~#&nbsp;strace&nbsp;-e&nbsp;open&nbsp;pwd\nopen(\"\/etc\/ld.so.cache\",&nbsp;O_RDONLY|O_CLOEXEC)&nbsp;=&nbsp;3\nopen(\"\/lib\/x86_64-linux-gnu\/libc.so.6\",&nbsp;O_RDONLY|O_CLOEXEC)&nbsp;=&nbsp;3\nopen(\"\/usr\/lib\/locale\/locale-archive\",&nbsp;O_RDONLY|O_CLOEXEC)&nbsp;=&nbsp;3\n\/root\n+++&nbsp;exited&nbsp;with&nbsp;0&nbsp;+++\nroot@linuxnix:~#<\/pre>\n<p>\u5982\u679c\u4f60\u6ce8\u610f\u5230\u7684\u8bdd\uff0c\u4f1a\u53d1\u73b0\u6211\u4eec\u4f7f\u7528\u7684 pwd \u547d\u4ee4\u7684\u6267\u884c\u9700\u8981\u8c03\u7528\u4e24\u4e2a\u5e93\u6587\u4ef6\u3002<\/p>\n<p><strong>Linux \u4e2d <code>\/lib<\/code> \u6587\u4ef6\u5939\u5185\u90e8\u4fe1\u606f<\/strong><\/p>\n<p>\u6b63\u5982\u4e4b\u524d\u6240\u8bf4\uff0c\u8fd9\u4e2a\u6587\u4ef6\u5939\u5305\u542b\u4e86\u76ee\u6807\u6587\u4ef6\u548c\u4e00\u4e9b\u5e93\u6587\u4ef6\uff0c\u5982\u679c\u80fd\u4e86\u89e3\u8fd9\u4e2a\u6587\u4ef6\u5939\u7684\u4e00\u4e9b\u91cd\u8981\u5b50\u6587\u4ef6\uff0c\u60f3\u5fc5\u662f\u6781\u597d\u7684\u3002\u4e0b\u9762\u5217\u4e3e\u7684\u5185\u5bb9\u662f\u57fa\u4e8e\u6211\u81ea\u5df1\u7684\u7cfb\u7edf\uff0c\u5bf9\u4e8e\u4f60\u7684\u6765\u8bf4\uff0c\u53ef\u80fd\u4f1a\u6709\u6240\u4e0d\u540c\u3002<\/p>\n<pre>root@linuxnix:\/lib#&nbsp;find&nbsp;.&nbsp;-maxdepth&nbsp;1&nbsp;&nbsp;-type&nbsp;d\n.\/firmware\n.\/modprobe.d\n.\/xtables\n.\/apparmor\n.\/terminfo\n.\/plymouth\n.\/init\n.\/lsb\n.\/recovery-mode\n.\/resolvconf\n.\/crda\n.\/modules\n.\/hdparm\n.\/udev\n.\/ufw\n.\/ifupdown\n.\/systemd\n.\/modules-load.d<\/pre>\n<p><code>\/lib\/firmware<\/code> &#8211; \u8fd9\u4e2a\u6587\u4ef6\u5939\u5305\u542b\u4e86\u4e00\u4e9b\u786c\u4ef6\u3001\u56fa\u4ef6\uff08Firmware\uff09\u4ee3\u7801\u3002<\/p>\n<blockquote>\n<p>\u786c\u4ef6\u548c\u56fa\u4ef6\u4e4b\u95f4\u6709\u4ec0\u4e48\u4e0d\u540c\uff1f<\/p>\n<p>\u4e3a\u4e86\u4f7f\u786c\u4ef6\u6b63\u5e38\u8fd0\u884c\uff0c\u5f88\u591a\u8bbe\u5907\u8f6f\u4ef6\u7531\u4e24\u90e8\u5206\u8f6f\u4ef6\u7ec4\u6210\u3002\u52a0\u8f7d\u5230\u5b9e\u9645\u786c\u4ef6\u7684\u4ee3\u7801\u90e8\u5206\u5c31\u662f\u56fa\u4ef6\uff0c\u7528\u4e8e\u5728\u56fa\u4ef6\u548c\u5185\u6838\u4e4b\u95f4\u901a\u8baf\u7684\u8f6f\u4ef6\u88ab\u79f0\u4e3a\u9a71\u52a8\u7a0b\u5e8f\u3002\u8fd9\u6837\u4e00\u6765\uff0c\u5185\u6838\u5c31\u53ef\u4ee5\u76f4\u63a5\u4e0e\u786c\u4ef6\u901a\u8baf\uff0c\u5e76\u786e\u4fdd\u786c\u4ef6\u5b8c\u6210\u5185\u6838\u6307\u6d3e\u7684\u5de5\u4f5c\u3002<\/p>\n<\/blockquote>\n<p><code>\/lib\/modprobe.d<\/code> &#8211; modprobe \u547d\u4ee4\u7684\u914d\u7f6e\u76ee\u5f55\u3002<\/p>\n<p><code>\/lib\/modules<\/code> &#8211; \u6240\u6709\u7684\u53ef\u52a0\u8f7d\u5185\u6838\u6a21\u5757\u90fd\u5b58\u50a8\u5728\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u3002\u5982\u679c\u4f60\u6709\u591a\u4e2a\u5185\u6838\uff0c\u4f60\u4f1a\u5728\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u770b\u5230\u4ee3\u8868\u7f8e\u56fd\u5185\u6838\u7684\u76ee\u5f55\u3002<\/p>\n<p><code>\/lib\/hdparm<\/code> &#8211; \u5305\u542b SATA\/IDE \u786c\u76d8\u6b63\u786e\u8fd0\u884c\u7684\u53c2\u6570\u3002<\/p>\n<p><code>\/lib\/udev<\/code> &#8211; \u7528\u6237\u7a7a\u95f4 \/dev \u662f Linux \u5185\u6838\u8bbe\u5907\u7ba1\u7406\u5668\u3002\u8fd9\u4e2a\u6587\u4ef6\u5939\u5305\u542b\u4e86\u6240\u6709\u7684 udev \u76f8\u5173\u7684\u6587\u4ef6\u548c\u6587\u4ef6\u5939\uff0c\u4f8b\u5982 rules.d \u5305\u542b\u4e86 udev \u89c4\u8303\u6587\u4ef6\u3002<\/p>\n<p><strong>\u6269\u5c55\u77e5\u8bc6\uff1a<\/strong><\/p>\n<p><strong>\/lib \u7684\u59ca\u59b9\u6587\u4ef6\u5939\uff1a<\/strong><strong><code>\/lib32<\/code> \u548c <code>\/lib64<\/code><\/strong><\/p>\n<p>\u8fd9\u4e24\u4e2a\u6587\u4ef6\u5939\u5305\u542b\u4e86\u7279\u6b8a\u7ed3\u6784\u7684\u5e93\u6587\u4ef6\u3002\u5b83\u4eec\u51e0\u4e4e\u548c <code>\/lib<\/code> \u6587\u4ef6\u5939\u4e00\u6837\uff0c\u9664\u4e86\u67b6\u6784\u7ea7\u522b\u7684\u5dee\u5f02\u3002<\/p>\n<p><strong>Linux \u5176\u4ed6\u7684\u5e93\u6587\u4ef6<\/strong><\/p>\n<ul>\n<li>\n<p><code>\/usr\/lib<\/code> &#8211; \u6240\u6709\u8f6f\u4ef6\u7684\u5e93\u90fd\u5b89\u88c5\u5728\u8fd9\u91cc\u3002\u4f46\u662f\u4e0d\u5305\u542b\u7cfb\u7edf\u9ed8\u8ba4\u5e93\u6587\u4ef6\u548c\u5185\u6838\u5e93\u6587\u4ef6\u3002<\/p>\n<\/li>\n<li>\n<p><code>\/usr\/local\/lib<\/code> &#8211; \u653e\u7f6e\u989d\u5916\u7684\u7cfb\u7edf\u6587\u4ef6\u3002\u8fd9\u4e9b\u5e93\u80fd\u591f\u7528\u4e8e\u5404\u79cd\u5e94\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><code>\/var\/lib<\/code> &#8211; \u5b58\u50a8\u52a8\u6001\u6570\u636e\u7684\u5e93\u548c\u6587\u4ef6\uff0c\u4f8b\u5982 <code>rpm\/dpkg<\/code> \u6570\u636e\u548c\u6e38\u620f\u8bb0\u5f55\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4eca\u5929\u5173\u4e8e\u300alinux\u4e2dlib\u6307\u7684\u662f\u4ec0\u4e48\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8eLinux,lib\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>linux\u4e2dlib\u6307\u7684\u662f\u4ec0\u4e48 \u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u5206\u4eab\u300alinux\u4e2dlib\u6307\u7684\u662f\u4ec0\u4e48\u300b\uff0c\u8986\u76d6\u4e86\u6587\u7ae0\u7684\u5e38\u89c1\u57fa\u7840\u77e5\u8bc6\uff0c\u5176\u5b9e\u4e00\u4e2a\u8bed\u8a00\u7684\u5168\u90e8\u77e5\u8bc6\u70b9\u4e00\u7bc7\u6587\u7ae0\u662f\u4e0d\u53ef\u80fd\u8bf4\u5b8c\u7684\uff0c\u4f46\u5e0c\u671b\u901a\u8fc7\u8fd9\u4e9b\u95ee\u9898\uff0c\u8ba9\u8bfb\u8005\u5bf9\u81ea\u5df1\u7684\u638c\u63e1\u7a0b\u5ea6\u6709\u4e00\u5b9a\u7684\u8ba4\u8bc6(B \u6570)\uff0c\u4ece\u800c\u5f25\u8865\u81ea\u5df1\u7684\u4e0d\u8db3\uff0c\u66f4\u597d\u7684\u638c\u63e1\u5b83\u3002 \u5728linux\u4e2d\uff0clib\u662f\u5e93\u6587\u4ef6\u76ee\u5f55\uff0c\u5305\u542b\u4e86\u6240\u6709\u5bf9\u7cfb\u7edf\u6709\u7528\u7684\u5e93\u6587\u4ef6\uff1b\u5e93\u6587\u4ef6\u662f\u5e94\u7528\u7a0b\u5e8f\u3001\u547d\u4ee4\u6216\u8fdb\u7a0b\u6b63\u786e\u6267\u884c\u6240\u9700\u8981\u7684\u6587\u4ef6\u3002lib\u7684\u4f5c\u7528\u7c7b\u4f3c\u4e8eWindows\u91cc\u7684DLL\u6587\u4ef6\uff0c\u51e0\u4e4e\u6240\u6709\u7684\u5e94\u7528\u7a0b\u5e8f\u90fd\u9700\u8981\u7528\u5230lib\u76ee\u5f55\u91cc\u7684\u5171\u4eab\u5e93\u6587\u4ef6\u3002 lib \u662f Library(\u5e93) \u7684\u7f29\u5199\u8fd9\u4e2a\u76ee\u5f55\u91cc\u5b58\u653e\u7740\u7cfb\u7edf\u6700\u57fa\u672c\u7684\u52a8\u6001\u8fde\u63a5\u5171\u4eab\u5e93\uff0c\u5176\u4f5c\u7528\u7c7b\u4f3c\u4e8e Windows \u91cc\u7684 DLL \u6587\u4ef6\u3002\u51e0\u4e4e\u6240\u6709\u7684\u5e94\u7528\u7a0b\u5e8f\u90fd\u9700\u8981\u7528\u5230\u8fd9\u4e9b\u5171\u4eab\u5e93\u3002 \/lib \u6587\u4ef6\u5939\u662f \u5e93\u6587\u4ef6\u76ee\u5f55 \uff0c\u5305\u542b\u4e86\u6240\u6709\u5bf9\u7cfb\u7edf\u6709\u7528\u7684\u5e93\u6587\u4ef6\u3002\u7b80\u5355\u6765\u8bf4\uff0c\u5b83\u662f\u5e94\u7528\u7a0b\u5e8f\u3001\u547d\u4ee4\u6216\u8fdb\u7a0b\u6b63\u786e\u6267\u884c\u6240\u9700\u8981\u7684\u6587\u4ef6\u3002\u5728 \/bin \u6216 \/sbin \u76ee\u5f55\u4e2d\u7684\u547d\u4ee4\u7684\u52a8\u6001\u5e93\u6587\u4ef6\u6b63\u662f\u5728\u6b64\u76ee\u5f55\u4e2d\u3002\u5185\u6838\u6a21\u5757\u540c\u6837\u4e5f\u5728\u8fd9\u91cc\u3002 \u4ee5 pwd \u547d\u4ee4\u6267\u884c\u4e3a\u4f8b\u3002\u6267\u884c\u5b83\u9700\u8981\u8c03\u7528\u4e00\u4e9b\u5e93\u6587\u4ef6\u3002\u8ba9\u6211\u4eec\u6765\u63a2\u7d22\u4e00\u4e0b pwd \u547d\u4ee4\u6267\u884c\u65f6\u90fd\u53d1\u751f\u4e86\u4ec0\u4e48\u3002\u6211\u4eec\u9700\u8981\u4f7f\u7528 strace \u547d\u4ee4 \u627e\u51fa\u8c03\u7528\u7684\u5e93\u6587\u4ef6\u3002 \u793a\u4f8b\uff1a root@linuxnix:~#&nbsp;strace&nbsp;-e&nbsp;open&nbsp;pwd open(&#8220;\/etc\/ld.so.cache&#8221;,&nbsp;O_RDONLY|O_CLOEXEC)&nbsp;=&nbsp;3 open(&#8220;\/lib\/x86_64-linux-gnu\/libc.so.6&#8221;,&nbsp;O_RDONLY|O_CLOEXEC)&nbsp;=&nbsp;3 open(&#8220;\/usr\/lib\/locale\/locale-archive&#8221;,&nbsp;O_RDONLY|O_CLOEXEC)&nbsp;=&nbsp;3 \/root +++&nbsp;exited&nbsp;with&nbsp;0&nbsp;+++ root@linuxnix:~# \u5982\u679c\u4f60\u6ce8\u610f\u5230\u7684\u8bdd\uff0c\u4f1a\u53d1\u73b0\u6211\u4eec\u4f7f\u7528\u7684 pwd \u547d\u4ee4\u7684\u6267\u884c\u9700\u8981\u8c03\u7528\u4e24\u4e2a\u5e93\u6587\u4ef6\u3002 Linux \u4e2d \/lib \u6587\u4ef6\u5939\u5185\u90e8\u4fe1\u606f \u6b63\u5982\u4e4b\u524d\u6240\u8bf4\uff0c\u8fd9\u4e2a\u6587\u4ef6\u5939\u5305\u542b\u4e86\u76ee\u6807\u6587\u4ef6\u548c\u4e00\u4e9b\u5e93\u6587\u4ef6\uff0c\u5982\u679c\u80fd\u4e86\u89e3\u8fd9\u4e2a\u6587\u4ef6\u5939\u7684\u4e00\u4e9b\u91cd\u8981\u5b50\u6587\u4ef6\uff0c\u60f3\u5fc5\u662f\u6781\u597d\u7684\u3002\u4e0b\u9762\u5217\u4e3e\u7684\u5185\u5bb9\u662f\u57fa\u4e8e\u6211\u81ea\u5df1\u7684\u7cfb\u7edf\uff0c\u5bf9\u4e8e\u4f60\u7684\u6765\u8bf4\uff0c\u53ef\u80fd\u4f1a\u6709\u6240\u4e0d\u540c\u3002 root@linuxnix:\/lib#&nbsp;find&nbsp;.&nbsp;-maxdepth&nbsp;1&nbsp;&nbsp;-type&nbsp;d .\/firmware .\/modprobe.d .\/xtables .\/apparmor .\/terminfo .\/plymouth .\/init .\/lsb .\/recovery-mode .\/resolvconf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-52312","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=52312"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52312\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}