{"id":17808,"date":"2024-11-18T14:26:37","date_gmt":"2024-11-18T06:26:37","guid":{"rendered":"https:\/\/fwq.ai\/blog\/17808\/"},"modified":"2024-11-18T14:26:37","modified_gmt":"2024-11-18T06:26:37","slug":"%e8%a7%a3%e5%86%b3linux%e5%91%bd%e4%bb%a4%e8%a1%8c%e6%98%be%e7%a4%ba%e4%b9%b1%e7%a0%81%e9%97%ae%e9%a2%98%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/17808\/","title":{"rendered":"\u89e3\u51b3Linux\u547d\u4ee4\u884c\u663e\u793a\u4e71\u7801\u95ee\u9898\u7684\u65b9\u6cd5"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/164\/171098100960444.jpg\" class=\"aligncenter\" title=\"\u89e3\u51b3Linux\u547d\u4ee4\u884c\u663e\u793a\u4e71\u7801\u95ee\u9898\u7684\u65b9\u6cd5\u63d2\u56fe\" alt=\"\u89e3\u51b3Linux\u547d\u4ee4\u884c\u663e\u793a\u4e71\u7801\u95ee\u9898\u7684\u65b9\u6cd5\u63d2\u56fe\" \/><\/p>\n<p>\u89e3\u51b3Linux\u547d\u4ee4\u884c\u663e\u793a\u4e71\u7801\u95ee\u9898\u7684\u65b9\u6cd5<\/p>\n<p>\u5728Linux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0c\u6709\u65f6\u5019\u6211\u4eec\u5728\u4f7f\u7528\u547d\u4ee4\u884c\u754c\u9762\u65f6\u4f1a\u9047\u5230\u663e\u793a\u4e71\u7801\u7684\u60c5\u51b5\uff0c\u8fd9\u4f1a\u5f71\u54cd\u6211\u4eec\u5bf9\u547d\u4ee4\u8f93\u51fa\u7ed3\u679c\u6216\u6587\u4ef6\u5185\u5bb9\u7684\u6b63\u5e38\u67e5\u770b\u548c\u7406\u89e3\u3002\u9020\u6210\u4e71\u7801\u7684\u539f\u56e0\u53ef\u80fd\u662f\u7531\u4e8e\u7cfb\u7edf\u5b57\u7b26\u96c6\u8bbe\u7f6e\u4e0d\u6b63\u786e\u3001\u7ec8\u7aef\u8f6f\u4ef6\u4e0d\u652f\u6301\u663e\u793a\u7279\u5b9a\u5b57\u7b26\u96c6\u3001\u6587\u4ef6\u7f16\u7801\u683c\u5f0f\u4e0d\u7edf\u4e00\u7b49\u95ee\u9898\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u4e00\u4e9b\u89e3\u51b3Linux\u547d\u4ee4\u884c\u663e\u793a\u4e71\u7801\u95ee\u9898\u7684\u65b9\u6cd5\uff0c\u540c\u65f6\u63d0\u4f9b\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u5e2e\u52a9\u8bfb\u8005\u89e3\u51b3\u7c7b\u4f3c\u95ee\u9898\u3002<\/p>\n<ol>\n<li>\u68c0\u67e5\u7cfb\u7edf\u5b57\u7b26\u96c6\u8bbe\u7f6e<\/li>\n<\/ol>\n<p>Linux\u7cfb\u7edf\u7684\u5b57\u7b26\u96c6\u8bbe\u7f6e\u901a\u5e38\u4fdd\u5b58\u5728\u73af\u5883\u53d8\u91cfLANG\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u7684\u5b57\u7b26\u96c6\u8bbe\u7f6e\uff1a<\/p>\n<pre>echo $LANG<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u679c\u663e\u793a\u7ed3\u679c\u4e3a\u4e71\u7801\u6216\u4e0d\u6b63\u786e\u7684\u5b57\u7b26\u96c6\uff0c\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u6765\u8bbe\u7f6e\u6b63\u786e\u7684\u5b57\u7b26\u96c6\u3002\u4fee\u6539~\/.bashrc\u6216\/etc\/profile\u6587\u4ef6\uff0c\u5728\u5176\u4e2d\u6dfb\u52a0\u5982\u4e0b\u884c\uff1a<\/p>\n<pre>export LANG=zh_CN.UTF-8<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7136\u540e\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u4f7f\u4fee\u6539\u751f\u6548\uff1a<\/p>\n<pre>source ~\/.bashrc<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u4fee\u6539\u7ec8\u7aef\u8f6f\u4ef6\u5b57\u7b26\u96c6<\/li>\n<\/ol>\n<p>\u6709\u4e9b\u7ec8\u7aef\u8f6f\u4ef6\u53ef\u80fd\u4e0d\u652f\u6301\u663e\u793a\u67d0\u4e9b\u5b57\u7b26\u96c6\uff0c\u5bfc\u81f4\u4e71\u7801\u95ee\u9898\u3002\u53ef\u4ee5\u5c1d\u8bd5\u4fee\u6539\u7ec8\u7aef\u8f6f\u4ef6\u7684\u5b57\u7b26\u96c6\u8bbe\u7f6e\uff0c\u8bbe\u7f6e\u4e3aUTF-8\u7f16\u7801\u3002\u4ee5gnome-terminal\u4e3a\u4f8b\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u8bbe\u7f6e\uff1a<\/p>\n<p>\u6253\u5f00gnome-terminal\uff0c\u70b9\u51fb\u754c\u9762\u5de6\u4e0a\u89d2\u7684\u201c\u7f16\u8f91\u201d\u9009\u9879\uff0c\u9009\u62e9\u201c\u9996\u9009\u9879\u201d\uff0c\u5728\u6253\u5f00\u7684\u5bf9\u8bdd\u6846\u4e2d\u9009\u62e9\u201c\u6587\u672c\u201d\u9009\u9879\u5361\uff0c\u5c06\u201c\u5b57\u7b26\u7f16\u7801\u201d\u8bbe\u7f6e\u4e3a\u201cUnicode (UTF-8)\u201d\u3002<\/p>\n<ol>\n<li>\u4fee\u6539\u6587\u4ef6\u7f16\u7801\u683c\u5f0f<\/li>\n<\/ol>\n<p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u6709\u65f6\u5019\u6211\u4eec\u4f1a\u9047\u5230\u4e0d\u540c\u7f16\u7801\u683c\u5f0f\u7684\u6587\u4ef6\uff0c\u5982\u679c\u6587\u4ef6\u7f16\u7801\u683c\u5f0f\u4e0e\u7cfb\u7edf\u5b57\u7b26\u96c6\u4e0d\u4e00\u81f4\uff0c\u4e5f\u4f1a\u5bfc\u81f4\u663e\u793a\u4e71\u7801\u3002\u53ef\u4ee5\u4f7f\u7528\u5de5\u5177\u5982iconv\u8fdb\u884c\u7f16\u7801\u683c\u5f0f\u8f6c\u6362\u3002\u4ee5\u5c06GBK\u7f16\u7801\u7684\u6587\u4ef6\u8f6c\u6362\u4e3aUTF-8\u4e3a\u4f8b\uff0c\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>iconv -f gbk -t utf-8 input.txt &amp;gt; output.txt<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u6837\u5c31\u5c06input.txt\u6587\u4ef6\u4eceGBK\u7f16\u7801\u8f6c\u6362\u4e3aUTF-8\u7f16\u7801\uff0c\u5e76\u8f93\u51fa\u5230output.txt\u6587\u4ef6\u4e2d\u3002<\/p>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u6709\u6548\u89e3\u51b3Linux\u547d\u4ee4\u884c\u663e\u793a\u4e71\u7801\u7684\u95ee\u9898\u3002\u5728\u5b9e\u9645\u4f7f\u7528\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u60c5\u51b5\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u6765\u89e3\u51b3\u4e71\u7801\u95ee\u9898\uff0c\u4fdd\u8bc1\u547d\u4ee4\u884c\u64cd\u4f5c\u7684\u987a\u5229\u8fdb\u884c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u89e3\u51b3Linux\u547d\u4ee4\u884c\u663e\u793a\u4e71\u7801\u95ee\u9898\u7684\u65b9\u6cd5\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>\u89e3\u51b3Linux\u547d\u4ee4\u884c\u663e\u793a\u4e71\u7801\u95ee\u9898\u7684\u65b9\u6cd5 \u5728Linux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0c\u6709\u65f6\u5019\u6211\u4eec\u5728\u4f7f\u7528\u547d\u4ee4\u884c\u754c\u9762\u65f6\u4f1a\u9047\u5230\u663e\u793a\u4e71\u7801\u7684\u60c5\u51b5\uff0c\u8fd9\u4f1a\u5f71\u54cd\u6211\u4eec\u5bf9\u547d\u4ee4\u8f93\u51fa\u7ed3\u679c\u6216\u6587\u4ef6\u5185\u5bb9\u7684\u6b63\u5e38\u67e5\u770b\u548c\u7406\u89e3\u3002\u9020\u6210\u4e71\u7801\u7684\u539f\u56e0\u53ef\u80fd\u662f\u7531\u4e8e\u7cfb\u7edf\u5b57\u7b26\u96c6\u8bbe\u7f6e\u4e0d\u6b63\u786e\u3001\u7ec8\u7aef\u8f6f\u4ef6\u4e0d\u652f\u6301\u663e\u793a\u7279\u5b9a\u5b57\u7b26\u96c6\u3001\u6587\u4ef6\u7f16\u7801\u683c\u5f0f\u4e0d\u7edf\u4e00\u7b49\u95ee\u9898\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u4e00\u4e9b\u89e3\u51b3Linux\u547d\u4ee4\u884c\u663e\u793a\u4e71\u7801\u95ee\u9898\u7684\u65b9\u6cd5\uff0c\u540c\u65f6\u63d0\u4f9b\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u5e2e\u52a9\u8bfb\u8005\u89e3\u51b3\u7c7b\u4f3c\u95ee\u9898\u3002 \u68c0\u67e5\u7cfb\u7edf\u5b57\u7b26\u96c6\u8bbe\u7f6e Linux\u7cfb\u7edf\u7684\u5b57\u7b26\u96c6\u8bbe\u7f6e\u901a\u5e38\u4fdd\u5b58\u5728\u73af\u5883\u53d8\u91cfLANG\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u7684\u5b57\u7b26\u96c6\u8bbe\u7f6e\uff1a echo $LANG \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u663e\u793a\u7ed3\u679c\u4e3a\u4e71\u7801\u6216\u4e0d\u6b63\u786e\u7684\u5b57\u7b26\u96c6\uff0c\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u6765\u8bbe\u7f6e\u6b63\u786e\u7684\u5b57\u7b26\u96c6\u3002\u4fee\u6539~\/.bashrc\u6216\/etc\/profile\u6587\u4ef6\uff0c\u5728\u5176\u4e2d\u6dfb\u52a0\u5982\u4e0b\u884c\uff1a export LANG=zh_CN.UTF-8 \u767b\u5f55\u540e\u590d\u5236 \u7136\u540e\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u4f7f\u4fee\u6539\u751f\u6548\uff1a source ~\/.bashrc \u767b\u5f55\u540e\u590d\u5236 \u4fee\u6539\u7ec8\u7aef\u8f6f\u4ef6\u5b57\u7b26\u96c6 \u6709\u4e9b\u7ec8\u7aef\u8f6f\u4ef6\u53ef\u80fd\u4e0d\u652f\u6301\u663e\u793a\u67d0\u4e9b\u5b57\u7b26\u96c6\uff0c\u5bfc\u81f4\u4e71\u7801\u95ee\u9898\u3002\u53ef\u4ee5\u5c1d\u8bd5\u4fee\u6539\u7ec8\u7aef\u8f6f\u4ef6\u7684\u5b57\u7b26\u96c6\u8bbe\u7f6e\uff0c\u8bbe\u7f6e\u4e3aUTF-8\u7f16\u7801\u3002\u4ee5gnome-terminal\u4e3a\u4f8b\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u8bbe\u7f6e\uff1a \u6253\u5f00gnome-terminal\uff0c\u70b9\u51fb\u754c\u9762\u5de6\u4e0a\u89d2\u7684\u201c\u7f16\u8f91\u201d\u9009\u9879\uff0c\u9009\u62e9\u201c\u9996\u9009\u9879\u201d\uff0c\u5728\u6253\u5f00\u7684\u5bf9\u8bdd\u6846\u4e2d\u9009\u62e9\u201c\u6587\u672c\u201d\u9009\u9879\u5361\uff0c\u5c06\u201c\u5b57\u7b26\u7f16\u7801\u201d\u8bbe\u7f6e\u4e3a\u201cUnicode (UTF-8)\u201d\u3002 \u4fee\u6539\u6587\u4ef6\u7f16\u7801\u683c\u5f0f \u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u6709\u65f6\u5019\u6211\u4eec\u4f1a\u9047\u5230\u4e0d\u540c\u7f16\u7801\u683c\u5f0f\u7684\u6587\u4ef6\uff0c\u5982\u679c\u6587\u4ef6\u7f16\u7801\u683c\u5f0f\u4e0e\u7cfb\u7edf\u5b57\u7b26\u96c6\u4e0d\u4e00\u81f4\uff0c\u4e5f\u4f1a\u5bfc\u81f4\u663e\u793a\u4e71\u7801\u3002\u53ef\u4ee5\u4f7f\u7528\u5de5\u5177\u5982iconv\u8fdb\u884c\u7f16\u7801\u683c\u5f0f\u8f6c\u6362\u3002\u4ee5\u5c06GBK\u7f16\u7801\u7684\u6587\u4ef6\u8f6c\u6362\u4e3aUTF-8\u4e3a\u4f8b\uff0c\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a iconv -f gbk -t utf-8 input.txt &amp;gt; output.txt \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u6837\u5c31\u5c06input.txt\u6587\u4ef6\u4eceGBK\u7f16\u7801\u8f6c\u6362\u4e3aUTF-8\u7f16\u7801\uff0c\u5e76\u8f93\u51fa\u5230output.txt\u6587\u4ef6\u4e2d\u3002 \u901a\u8fc7\u4ee5\u4e0a\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u6709\u6548\u89e3\u51b3Linux\u547d\u4ee4\u884c\u663e\u793a\u4e71\u7801\u7684\u95ee\u9898\u3002\u5728\u5b9e\u9645\u4f7f\u7528\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u60c5\u51b5\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u6765\u89e3\u51b3\u4e71\u7801\u95ee\u9898\uff0c\u4fdd\u8bc1\u547d\u4ee4\u884c\u64cd\u4f5c\u7684\u987a\u5229\u8fdb\u884c\u3002 \u4ee5\u4e0a\u5c31\u662f\u89e3\u51b3Linux\u547d\u4ee4\u884c\u663e\u793a\u4e71\u7801\u95ee\u9898\u7684\u65b9\u6cd5\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/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-17808","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/17808","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=17808"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/17808\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=17808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=17808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=17808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}