{"id":18171,"date":"2024-11-18T11:26:55","date_gmt":"2024-11-18T03:26:55","guid":{"rendered":"https:\/\/fwq.ai\/blog\/18171\/"},"modified":"2024-11-18T11:26:55","modified_gmt":"2024-11-18T03:26:55","slug":"linux%e6%9c%aa%e6%89%be%e5%88%b0%e5%91%bd%e4%bb%a4%e6%80%8e%e4%b9%88%e8%a7%a3%e5%86%b3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/18171\/","title":{"rendered":"linux\u672a\u627e\u5230\u547d\u4ee4\u600e\u4e48\u89e3\u51b3"},"content":{"rendered":"<blockquote><p>\n  \u5f53\u5728 linux \u4e2d\u9047\u5230\u201c\u672a\u627e\u5230\u547d\u4ee4\u201d\u9519\u8bef\u65f6\uff0c\u539f\u56e0\u53ef\u80fd\u5305\u62ec\uff1a\u547d\u4ee4\u540d\u62fc\u5199\u9519\u8bef\u547d\u4ee4\u4e0d\u5728 path \u73af\u5883\u53d8\u91cf\u4e2d\u672a\u5b89\u88c5\u5fc5\u9700\u7684\u5305\u6743\u9650\u4e0d\u8db3\u547d\u4ee4\u5df2\u5f03\u7528\u6216\u5df2\u5220\u9664\u73af\u5883\u95ee\u9898shell \u914d\u7f6e\u95ee\u9898\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/04\/2024060411421872258.jpg\" class=\"aligncenter\" title=\"linux\u672a\u627e\u5230\u547d\u4ee4\u600e\u4e48\u89e3\u51b3\u63d2\u56fe\" alt=\"linux\u672a\u627e\u5230\u547d\u4ee4\u600e\u4e48\u89e3\u51b3\u63d2\u56fe\" \/><\/p>\n<p><strong>\u89e3\u51b3 Linux \u4e2d\u201c\u672a\u627e\u5230\u547d\u4ee4\u201d\u9519\u8bef<\/strong><\/p>\n<p>\u5728 Linux \u4e2d\u9047\u5230\u201c\u672a\u627e\u5230\u547d\u4ee4\u201d\u9519\u8bef\u65f6\uff0c\u53ef\u80fd\u662f\u4ee5\u4e0b\u539f\u56e0\u4e4b\u4e00\u9020\u6210\u7684\uff1a<\/p>\n<p><strong>1. \u547d\u4ee4\u540d\u62fc\u5199\u9519\u8bef<\/strong><\/p>\n<p>\u68c0\u67e5\u547d\u4ee4\u662f\u5426\u62fc\u5199\u6b63\u786e\u3002Linux \u547d\u4ee4\u901a\u5e38\u5bf9\u5927\u5c0f\u5199\u654f\u611f\u3002<\/p>\n<p><strong>2. \u547d\u4ee4\u4e0d\u5728 PATH \u73af\u5883\u53d8\u91cf\u4e2d<\/strong><\/p>\n<p>PATH \u73af\u5883\u53d8\u91cf\u6307\u5b9a\u4e86\u7cfb\u7edf\u5728\u4f55\u5904\u67e5\u627e\u547d\u4ee4\u3002\u5982\u679c\u547d\u4ee4\u4e0d\u5728 PATH \u4e2d\uff0c\u7cfb\u7edf\u5c06\u65e0\u6cd5\u627e\u5230\u5b83\u3002\u8981\u6dfb\u52a0\u547d\u4ee4\u5230 PATH\uff0c\u8bf7\u7f16\u8f91 ~\/.bashrc \u6587\u4ef6\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>export PATH=$PATH:\/path\/to\/command<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u786e\u4fdd\u7528\u8981\u6dfb\u52a0\u7684\u547d\u4ee4\u7684\u5b9e\u9645\u8def\u5f84\u66ff\u6362\u201c\/path\/to\/command\u201d\u3002<\/p>\n<p><strong>3. \u672a\u5b89\u88c5\u5fc5\u9700\u7684\u5305<\/strong><\/p>\n<p>\u67d0\u4e9b\u547d\u4ee4\u9700\u8981\u7279\u5b9a\u7684\u8f6f\u4ef6\u5305\u624d\u80fd\u6b63\u5e38\u5de5\u4f5c\u3002\u68c0\u67e5\u547d\u4ee4\u662f\u5426\u9700\u8981\u4efb\u4f55\u672a\u5b89\u88c5\u7684\u5305\u3002\u8981\u5b89\u88c5\u5305\uff0c\u8bf7\u4f7f\u7528\u5305\u7ba1\u7406\u5668\uff0c\u4f8b\u5982 apt-get\uff08\u5bf9\u4e8e\u57fa\u4e8e Debian \u7684\u53d1\u884c\u7248\uff09\u6216 yum\uff08\u5bf9\u4e8e\u57fa\u4e8e Red Hat \u7684\u53d1\u884c\u7248\uff09\u3002<\/p>\n<p><strong>4. \u6743\u9650\u4e0d\u8db3<\/strong><\/p>\n<p>\u786e\u4fdd\u60a8\u6709\u6743\u8fd0\u884c\u547d\u4ee4\u3002\u5c1d\u8bd5\u4f7f\u7528 sudo \u63d0\u5347\u7279\u6743\uff1a<\/p>\n<pre>sudo command<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u547d\u4ee4\u5df2\u5f03\u7528\u6216\u5df2\u5220\u9664<\/strong><\/p>\n<p>\u67d0\u4e9b\u547d\u4ee4\u53ef\u80fd\u4f1a\u968f\u7740\u65f6\u95f4\u7684\u63a8\u79fb\u800c\u88ab\u5f03\u7528\u6216\u5220\u9664\u3002\u68c0\u67e5\u547d\u4ee4\u662f\u5426\u662f\u6b64\u7c7b\u60c5\u51b5\u3002\u5982\u679c\u5b83\u662f\uff0c\u8bf7\u4f7f\u7528\u66ff\u4ee3\u547d\u4ee4\u3002<\/p>\n<p><strong>6. \u73af\u5883\u95ee\u9898<\/strong><\/p>\n<p>\u67d0\u4e9b\u73af\u5883\u95ee\u9898\u53ef\u80fd\u4f1a\u5f71\u54cd\u547d\u4ee4\u7684\u53ef\u7528\u6027\u3002\u5c1d\u8bd5\u5728\u4e0d\u540c\u7684\u7ec8\u7aef\u7a97\u53e3\u6216\u7528\u6237\u5e10\u6237\u4e2d\u8fd0\u884c\u547d\u4ee4\u3002\u91cd\u542f\u7cfb\u7edf\u4e5f\u53ef\u80fd\u89e3\u51b3\u95ee\u9898\u3002<\/p>\n<p><strong>7. Shell \u914d\u7f6e\u95ee\u9898<\/strong><\/p>\n<p>shell \u914d\u7f6e\u95ee\u9898\u4e5f\u53ef\u80fd\u5bfc\u81f4\u201c\u672a\u627e\u5230\u547d\u4ee4\u201d\u9519\u8bef\u3002\u68c0\u67e5 ~\/.bashrc \u6587\u4ef6\u4e2d\u662f\u5426\u6709\u4efb\u4f55\u9519\u8bef\u6216\u7f3a\u5931\u7684\u914d\u7f6e\u3002<\/p>\n<p><strong>\u5176\u4ed6\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528 whereis \u547d\u4ee4\u67e5\u627e\u547d\u4ee4\u7684\u8def\u5f84\uff1a<\/li>\n<\/ul>\n<pre>whereis command<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u4f7f\u7528 type \u547d\u4ee4\u67e5\u770b\u547d\u4ee4\u7684\u7c7b\u578b\uff1a<\/li>\n<\/ul>\n<pre>type command<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u4f7f\u7528 which \u547d\u4ee4\u67e5\u627e\u547d\u4ee4\u7684\u5b9e\u9645\u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/li>\n<\/ul>\n<pre>which command<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672a\u627e\u5230\u547d\u4ee4\u600e\u4e48\u89e3\u51b3\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u5728 linux \u4e2d\u9047\u5230\u201c\u672a\u627e\u5230\u547d\u4ee4\u201d\u9519\u8bef\u65f6\uff0c\u539f\u56e0\u53ef\u80fd\u5305\u62ec\uff1a\u547d\u4ee4\u540d\u62fc\u5199\u9519\u8bef\u547d\u4ee4\u4e0d\u5728 path \u73af\u5883\u53d8\u91cf\u4e2d\u672a\u5b89\u88c5\u5fc5\u9700\u7684\u5305\u6743\u9650\u4e0d\u8db3\u547d\u4ee4\u5df2\u5f03\u7528\u6216\u5df2\u5220\u9664\u73af\u5883\u95ee\u9898shell \u914d\u7f6e\u95ee\u9898 \u89e3\u51b3 Linux \u4e2d\u201c\u672a\u627e\u5230\u547d\u4ee4\u201d\u9519\u8bef \u5728 Linux \u4e2d\u9047\u5230\u201c\u672a\u627e\u5230\u547d\u4ee4\u201d\u9519\u8bef\u65f6\uff0c\u53ef\u80fd\u662f\u4ee5\u4e0b\u539f\u56e0\u4e4b\u4e00\u9020\u6210\u7684\uff1a 1. \u547d\u4ee4\u540d\u62fc\u5199\u9519\u8bef \u68c0\u67e5\u547d\u4ee4\u662f\u5426\u62fc\u5199\u6b63\u786e\u3002Linux \u547d\u4ee4\u901a\u5e38\u5bf9\u5927\u5c0f\u5199\u654f\u611f\u3002 2. \u547d\u4ee4\u4e0d\u5728 PATH \u73af\u5883\u53d8\u91cf\u4e2d PATH \u73af\u5883\u53d8\u91cf\u6307\u5b9a\u4e86\u7cfb\u7edf\u5728\u4f55\u5904\u67e5\u627e\u547d\u4ee4\u3002\u5982\u679c\u547d\u4ee4\u4e0d\u5728 PATH \u4e2d\uff0c\u7cfb\u7edf\u5c06\u65e0\u6cd5\u627e\u5230\u5b83\u3002\u8981\u6dfb\u52a0\u547d\u4ee4\u5230 PATH\uff0c\u8bf7\u7f16\u8f91 ~\/.bashrc \u6587\u4ef6\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a export PATH=$PATH:\/path\/to\/command \u767b\u5f55\u540e\u590d\u5236 \u786e\u4fdd\u7528\u8981\u6dfb\u52a0\u7684\u547d\u4ee4\u7684\u5b9e\u9645\u8def\u5f84\u66ff\u6362\u201c\/path\/to\/command\u201d\u3002 3. \u672a\u5b89\u88c5\u5fc5\u9700\u7684\u5305 \u67d0\u4e9b\u547d\u4ee4\u9700\u8981\u7279\u5b9a\u7684\u8f6f\u4ef6\u5305\u624d\u80fd\u6b63\u5e38\u5de5\u4f5c\u3002\u68c0\u67e5\u547d\u4ee4\u662f\u5426\u9700\u8981\u4efb\u4f55\u672a\u5b89\u88c5\u7684\u5305\u3002\u8981\u5b89\u88c5\u5305\uff0c\u8bf7\u4f7f\u7528\u5305\u7ba1\u7406\u5668\uff0c\u4f8b\u5982 apt-get\uff08\u5bf9\u4e8e\u57fa\u4e8e Debian \u7684\u53d1\u884c\u7248\uff09\u6216 yum\uff08\u5bf9\u4e8e\u57fa\u4e8e Red Hat \u7684\u53d1\u884c\u7248\uff09\u3002 4. \u6743\u9650\u4e0d\u8db3 \u786e\u4fdd\u60a8\u6709\u6743\u8fd0\u884c\u547d\u4ee4\u3002\u5c1d\u8bd5\u4f7f\u7528 sudo \u63d0\u5347\u7279\u6743\uff1a sudo command \u767b\u5f55\u540e\u590d\u5236 5. \u547d\u4ee4\u5df2\u5f03\u7528\u6216\u5df2\u5220\u9664 \u67d0\u4e9b\u547d\u4ee4\u53ef\u80fd\u4f1a\u968f\u7740\u65f6\u95f4\u7684\u63a8\u79fb\u800c\u88ab\u5f03\u7528\u6216\u5220\u9664\u3002\u68c0\u67e5\u547d\u4ee4\u662f\u5426\u662f\u6b64\u7c7b\u60c5\u51b5\u3002\u5982\u679c\u5b83\u662f\uff0c\u8bf7\u4f7f\u7528\u66ff\u4ee3\u547d\u4ee4\u3002 6. \u73af\u5883\u95ee\u9898 \u67d0\u4e9b\u73af\u5883\u95ee\u9898\u53ef\u80fd\u4f1a\u5f71\u54cd\u547d\u4ee4\u7684\u53ef\u7528\u6027\u3002\u5c1d\u8bd5\u5728\u4e0d\u540c\u7684\u7ec8\u7aef\u7a97\u53e3\u6216\u7528\u6237\u5e10\u6237\u4e2d\u8fd0\u884c\u547d\u4ee4\u3002\u91cd\u542f\u7cfb\u7edf\u4e5f\u53ef\u80fd\u89e3\u51b3\u95ee\u9898\u3002 [&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-18171","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18171","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=18171"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18171\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=18171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=18171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=18171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}