{"id":57215,"date":"2025-03-01T16:14:57","date_gmt":"2025-03-01T08:14:57","guid":{"rendered":"https:\/\/fwq.ai\/blog\/57215\/"},"modified":"2025-03-01T16:14:57","modified_gmt":"2025-03-01T08:14:57","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8%e6%90%ac%e7%93%a6%e5%b7%a5%e4%b8%ad%e4%bd%bf%e7%94%a8nano%e6%89%93%e5%bc%80%e5%92%8c%e9%85%8d%e7%bd%ae-bash_profile","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/57215\/","title":{"rendered":"\u5982\u4f55\u5728\u642c\u74e6\u5de5\u4e2d\u4f7f\u7528nano\u6253\u5f00\u548c\u914d\u7f6e.bash_profile"},"content":{"rendered":"<p>\u5728\u4f7f\u7528\u642c\u74e6\u5de5\uff08Vultr\uff09\u63d0\u4f9b\u7684\u670d\u52a1\u5668\u65f6\uff0c\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u548c\u7528\u6237\u8bbe\u7f6e\u662f\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u6b65\u9aa4\u3002\u800c.bash_profile\u6587\u4ef6\u6b63\u662f\u7528\u4e8e\u5b58\u50a8\u8fd9\u4e9b\u914d\u7f6e\u7684\u5730\u65b9\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528nano\u7f16\u8f91\u5668\u6253\u5f00\u548c\u7f16\u8f91.bash_profile\u6587\u4ef6\u3002<\/p>\n<h2>\u4ec0\u4e48\u662f.bash_profile\uff1f<\/h2>\n<p>.bash_profile\u662f\u4e00\u4e2a\u9690\u85cf\u7684\u6587\u4ef6\uff0c\u901a\u5e38\u4f4d\u4e8e\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e0b\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u914d\u7f6e\u7528\u6237\u7684\u73af\u5883\u53d8\u91cf\u3001\u542f\u52a8\u7a0b\u5e8f\u7b49\u3002\u5728\u7528\u6237\u6bcf\u6b21\u767b\u5f55\u65f6\uff0c.bash_profile\u4f1a\u88ab\u6267\u884c\u3002\u901a\u8fc7\u914d\u7f6e\u8fd9\u4e2a\u6587\u4ef6\uff0c\u53ef\u4ee5\u4e3a\u7528\u6237\u63d0\u4f9b\u4e00\u4e2a\u66f4\u52a0\u7075\u6d3b\u548c\u5b9a\u5236\u7684\u64cd\u4f5c\u73af\u5883\u3002<\/p>\n<h3>.bash_profile\u7684\u529f\u80fd<\/h3>\n<ul>\n<li><strong>\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e<\/strong>\uff1a\u53ef\u4ee5\u5728\u8fd9\u91cc\u8bbe\u7f6ePATH\u7b49\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u65b9\u4fbf\u5730\u8c03\u7528\u7a0b\u5e8f\u3002<\/li>\n<li><strong>\u542f\u52a8\u7a0b\u5e8f<\/strong>\uff1a\u53ef\u4ee5\u5728\u767b\u5f55\u65f6\u81ea\u52a8\u542f\u52a8\u4e00\u4e9b\u5e38\u7528\u7a0b\u5e8f\u6216\u811a\u672c\u3002<\/li>\n<li><strong>\u4e2a\u6027\u5316\u8bbe\u7f6e<\/strong>\uff1a\u4f8b\u5982\u81ea\u5b9a\u4e49\u547d\u4ee4\u63d0\u793a\u7b26\u3001\u8bbe\u7f6e\u522b\u540d\u7b49\u3002<\/li>\n<\/ul>\n<h2>\u5728\u642c\u74e6\u5de5\u4e2d\u6253\u5f00.bash_profile\u6587\u4ef6<\/h2>\n<h3>\u6b65\u9aa41\uff1a\u8fde\u63a5\u5230\u642c\u74e6\u5de5\u670d\u52a1\u5668<\/h3>\n<p>\u4f7f\u7528SSH\u5ba2\u6237\u7aef\uff08\u5982PuTTY\u6216\u547d\u4ee4\u884c\u7ec8\u7aef\uff09\u8fde\u63a5\u5230\u4f60\u7684\u642c\u74e6\u5de5\u670d\u52a1\u5668\u3002<\/p>\n<p>bash ssh \u7528\u6237\u540d@\u670d\u52a1\u5668IP<\/p>\n<h3>\u6b65\u9aa42\uff1a\u6253\u5f00nano\u7f16\u8f91\u5668<\/h3>\n<p>\u4e00\u65e6\u6210\u529f\u8fde\u63a5\uff0c\u53ef\u4ee5\u4f7f\u7528nano\u7f16\u8f91\u5668\u6253\u5f00.bash_profile\u6587\u4ef6\u3002\u9996\u5148\uff0c\u8fdb\u5165\u7528\u6237\u4e3b\u76ee\u5f55\uff1a<\/p>\n<p>bash cd ~<\/p>\n<p>\u63a5\u7740\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6253\u5f00.bash_profile\uff1a<\/p>\n<p>bash nano .bash_profile<\/p>\n<h3>\u6b65\u9aa43\uff1a\u7f16\u8f91.bash_profile<\/h3>\n<p>\u5728nano\u7f16\u8f91\u5668\u4e2d\uff0c\u4f60\u53ef\u4ee5\u5f00\u59cb\u7f16\u8f91.bash_profile\u6587\u4ef6\u3002\u53ef\u4ee5\u6dfb\u52a0\u4f60\u9700\u8981\u7684\u73af\u5883\u53d8\u91cf\u3001\u522b\u540d\u6216\u8005\u5176\u4ed6\u914d\u7f6e\u3002\u4f8b\u5982\uff1a<\/p>\n<p>bash<\/p>\n<p>export PATH=$PATH:\/usr\/local\/bin<\/p>\n<p>alias ll=\u2019ls -al\u2019<\/p>\n<h3>\u6b65\u9aa44\uff1a\u4fdd\u5b58\u548c\u9000\u51fa<\/h3>\n<p>\u7f16\u8f91\u5b8c\u6210\u540e\uff0c\u6309\u4e0b<code>Ctrl + O<\/code>\u4fdd\u5b58\u6587\u4ef6\uff0c\u7136\u540e\u6309<code>Enter<\/code>\u786e\u8ba4\u6587\u4ef6\u540d\u3002\u63a5\u7740\uff0c\u6309<code>Ctrl + X<\/code>\u9000\u51fanano\u7f16\u8f91\u5668\u3002<\/p>\n<h2>\u5e38\u89c1\u7684.bash_profile\u914d\u7f6e\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684.bash_profile\u914d\u7f6e\u793a\u4f8b\uff0c\u4f9b\u53c2\u8003\uff1a<\/p>\n<ul>\n<li>\n<p><strong>\u6dfb\u52a0Java\u73af\u5883\u53d8\u91cf<\/strong>\uff1a bash export JAVA_HOME=\/usr\/lib\/jvm\/java-8-openjdk-amd64 export PATH=$PATH:$JAVA_HOME\/bin<\/p>\n<\/li>\n<li>\n<p><strong>\u8bbe\u7f6ePython\u522b\u540d<\/strong>\uff1a bash alias py=\u2019python3\u2032<\/p>\n<\/li>\n<\/ul>\n<h2>\u6d4b\u8bd5.bash_profile\u914d\u7f6e<\/h2>\n<p>\u5728\u7f16\u8f91\u5b8c.bash_profile\u540e\uff0c\u65b0\u7684\u914d\u7f6e\u5e76\u4e0d\u4f1a\u7acb\u5373\u751f\u6548\u3002\u9700\u8981\u91cd\u65b0\u52a0\u8f7d\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>bash source .bash_profile<\/p>\n<p>\u4e5f\u53ef\u4ee5\u9009\u62e9\u6ce8\u9500\u5e76\u91cd\u65b0\u767b\u5f55\u4ee5\u5e94\u7528\u66f4\u6539\u3002<\/p>\n<h2>\u6ce8\u610f\u4e8b\u9879<\/h2>\n<ul>\n<li>\u786e\u4fdd\u5728\u7f16\u8f91.bash_profile\u65f6\u5c0f\u5fc3\u64cd\u4f5c\uff0c\u4ee5\u514d\u8bef\u5220\u6216\u4fee\u6539\u91cd\u8981\u7684\u914d\u7f6e\u3002<\/li>\n<li>\u7f16\u8f91\u5b8c\u6210\u540e\uff0c\u4f7f\u7528<code>source<\/code>\u547d\u4ee4\u53ca\u65f6\u52a0\u8f7d\u66f4\u6539\uff0c\u4ee5\u514d\u9020\u6210\u73af\u5883\u53d8\u91cf\u4e0d\u751f\u6548\u3002<\/li>\n<\/ul>\n<h2>FAQ\uff08\u5e38\u89c1\u95ee\u9898\u89e3\u7b54\uff09<\/h2>\n<h3>1. \u5982\u4f55\u67e5\u627e.bash_profile\u6587\u4ef6\uff1f<\/h3>\n<p>.bash_profile\u6587\u4ef6\u4f4d\u4e8e\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e0b\uff0c\u4f7f\u7528\u547d\u4ee4<code>ls -a<\/code>\u53ef\u4ee5\u663e\u793a\u9690\u85cf\u6587\u4ef6\uff0c\u786e\u8ba4\u662f\u5426\u5b58\u5728\u3002<\/p>\n<h3>2. \u5982\u679c.bash_profile\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u6211\u8be5\u600e\u4e48\u529e\uff1f<\/h3>\n<p>\u5982\u679c.bash_profile\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u4f60\u53ef\u4ee5\u624b\u52a8\u521b\u5efa\u4e00\u4e2a\u3002\u53ea\u9700\u4f7f\u7528nano\u6216\u5176\u4ed6\u6587\u672c\u7f16\u8f91\u5668\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a bash nano .bash_profile<\/p>\n<p>\u7136\u540e\u8fdb\u884c\u914d\u7f6e\u3002<\/p>\n<h3>3. .bash_profile\u548c.bashrc\u6709\u4ec0\u4e48\u533a\u522b\uff1f<\/h3>\n<p>.bash_profile\u4e3b\u8981\u7528\u4e8e\u767b\u5f55\u65f6\u6267\u884c\uff0c\u800c.bashrc\u901a\u5e38\u7528\u4e8e\u4ea4\u4e92\u5f0f\u975e\u767b\u5f55shell\u3002\u5728\u4f7f\u7528SSH\u767b\u5f55\u65f6\uff0c.bash_profile\u4f1a\u88ab\u6267\u884c\uff0c\u800c\u5728\u65b0\u5f00\u7ec8\u7aef\u65f6\uff0c\u5219\u662f.bashrc\u3002<\/p>\n<h3>4. \u5982\u4f55\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u662f\u5426\u6210\u529f\u914d\u7f6e\uff1f<\/h3>\n<p>\u53ef\u4ee5\u4f7f\u7528<code>echo<\/code>\u547d\u4ee4\u67e5\u770b\u73af\u5883\u53d8\u91cf\u7684\u503c\uff0c\u4f8b\u5982\uff1a bash echo $JAVA_HOME<\/p>\n<p>\u5982\u679c\u8fd4\u56de\u503c\u6b63\u786e\uff0c\u8bf4\u660e\u914d\u7f6e\u6210\u529f\u3002<\/p>\n<h2>\u7ed3\u8bba<\/h2>\n<p>\u5728\u642c\u74e6\u5de5\u670d\u52a1\u5668\u4e0a\u4f7f\u7528nano\u7f16\u8f91.bash_profile\u6587\u4ef6\u662f\u4e00\u9879\u57fa\u672c\u800c\u91cd\u8981\u7684\u64cd\u4f5c\u3002\u901a\u8fc7\u6b63\u786e\u914d\u7f6e\u8fd9\u4e2a\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u5927\u5927\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\uff0c\u521b\u5efa\u66f4\u52a0\u4e2a\u6027\u5316\u7684\u4f7f\u7528\u73af\u5883\u3002\u5e0c\u671b\u672c\u7bc7\u6587\u7ae0\u80fd\u591f\u5e2e\u52a9\u4f60\u987a\u5229\u5b8c\u6210.bash_profile\u7684\u7f16\u8f91\u4e0e\u914d\u7f6e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f7f\u7528\u642c\u74e6\u5de5\uff08Vultr\uff09\u63d0\u4f9b\u7684\u670d\u52a1\u5668\u65f6\uff0c\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u548c\u7528\u6237\u8bbe\u7f6e\u662f\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u6b65\u9aa4\u3002\u800c.bash_profile\u6587\u4ef6\u6b63\u662f\u7528\u4e8e\u5b58\u50a8\u8fd9\u4e9b\u914d\u7f6e\u7684\u5730\u65b9\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528nano\u7f16\u8f91\u5668\u6253\u5f00\u548c\u7f16\u8f91.bash_profile\u6587\u4ef6\u3002 \u4ec0\u4e48\u662f.bash_profile\uff1f .bash_profile\u662f\u4e00\u4e2a\u9690\u85cf\u7684\u6587\u4ef6\uff0c\u901a\u5e38\u4f4d\u4e8e\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e0b\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u914d\u7f6e\u7528\u6237\u7684\u73af\u5883\u53d8\u91cf\u3001\u542f\u52a8\u7a0b\u5e8f\u7b49\u3002\u5728\u7528\u6237\u6bcf\u6b21\u767b\u5f55\u65f6\uff0c.bash_profile\u4f1a\u88ab\u6267\u884c\u3002\u901a\u8fc7\u914d\u7f6e\u8fd9\u4e2a\u6587\u4ef6\uff0c\u53ef\u4ee5\u4e3a\u7528\u6237\u63d0\u4f9b\u4e00\u4e2a\u66f4\u52a0\u7075\u6d3b\u548c\u5b9a\u5236\u7684\u64cd\u4f5c\u73af\u5883\u3002 .bash_profile\u7684\u529f\u80fd \u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\uff1a\u53ef\u4ee5\u5728\u8fd9\u91cc\u8bbe\u7f6ePATH\u7b49\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u65b9\u4fbf\u5730\u8c03\u7528\u7a0b\u5e8f\u3002 \u542f\u52a8\u7a0b\u5e8f\uff1a\u53ef\u4ee5\u5728\u767b\u5f55\u65f6\u81ea\u52a8\u542f\u52a8\u4e00\u4e9b\u5e38\u7528\u7a0b\u5e8f\u6216\u811a\u672c\u3002 \u4e2a\u6027\u5316\u8bbe\u7f6e\uff1a\u4f8b\u5982\u81ea\u5b9a\u4e49\u547d\u4ee4\u63d0\u793a\u7b26\u3001\u8bbe\u7f6e\u522b\u540d\u7b49\u3002 \u5728\u642c\u74e6\u5de5\u4e2d\u6253\u5f00.bash_profile\u6587\u4ef6 \u6b65\u9aa41\uff1a\u8fde\u63a5\u5230\u642c\u74e6\u5de5\u670d\u52a1\u5668 \u4f7f\u7528SSH\u5ba2\u6237\u7aef\uff08\u5982PuTTY\u6216\u547d\u4ee4\u884c\u7ec8\u7aef\uff09\u8fde\u63a5\u5230\u4f60\u7684\u642c\u74e6\u5de5\u670d\u52a1\u5668\u3002 bash ssh \u7528\u6237\u540d@\u670d\u52a1\u5668IP \u6b65\u9aa42\uff1a\u6253\u5f00nano\u7f16\u8f91\u5668 \u4e00\u65e6\u6210\u529f\u8fde\u63a5\uff0c\u53ef\u4ee5\u4f7f\u7528nano\u7f16\u8f91\u5668\u6253\u5f00.bash_profile\u6587\u4ef6\u3002\u9996\u5148\uff0c\u8fdb\u5165\u7528\u6237\u4e3b\u76ee\u5f55\uff1a bash cd ~ \u63a5\u7740\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6253\u5f00.bash_profile\uff1a bash nano .bash_profile \u6b65\u9aa43\uff1a\u7f16\u8f91.bash_profile \u5728nano\u7f16\u8f91\u5668\u4e2d\uff0c\u4f60\u53ef\u4ee5\u5f00\u59cb\u7f16\u8f91.bash_profile\u6587\u4ef6\u3002\u53ef\u4ee5\u6dfb\u52a0\u4f60\u9700\u8981\u7684\u73af\u5883\u53d8\u91cf\u3001\u522b\u540d\u6216\u8005\u5176\u4ed6\u914d\u7f6e\u3002\u4f8b\u5982\uff1a bash export PATH=$PATH:\/usr\/local\/bin alias ll=\u2019ls -al\u2019 \u6b65\u9aa44\uff1a\u4fdd\u5b58\u548c\u9000\u51fa \u7f16\u8f91\u5b8c\u6210\u540e\uff0c\u6309\u4e0bCtrl + O\u4fdd\u5b58\u6587\u4ef6\uff0c\u7136\u540e\u6309Enter\u786e\u8ba4\u6587\u4ef6\u540d\u3002\u63a5\u7740\uff0c\u6309Ctrl + X\u9000\u51fanano\u7f16\u8f91\u5668\u3002 \u5e38\u89c1\u7684.bash_profile\u914d\u7f6e\u793a\u4f8b \u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684.bash_profile\u914d\u7f6e\u793a\u4f8b\uff0c\u4f9b\u53c2\u8003\uff1a \u6dfb\u52a0Java\u73af\u5883\u53d8\u91cf\uff1a bash export JAVA_HOME=\/usr\/lib\/jvm\/java-8-openjdk-amd64 export PATH=$PATH:$JAVA_HOME\/bin \u8bbe\u7f6ePython\u522b\u540d\uff1a bash alias py=\u2019python3\u2032 \u6d4b\u8bd5.bash_profile\u914d\u7f6e \u5728\u7f16\u8f91\u5b8c.bash_profile\u540e\uff0c\u65b0\u7684\u914d\u7f6e\u5e76\u4e0d\u4f1a\u7acb\u5373\u751f\u6548\u3002\u9700\u8981\u91cd\u65b0\u52a0\u8f7d\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a bash source .bash_profile \u4e5f\u53ef\u4ee5\u9009\u62e9\u6ce8\u9500\u5e76\u91cd\u65b0\u767b\u5f55\u4ee5\u5e94\u7528\u66f4\u6539\u3002 \u6ce8\u610f\u4e8b\u9879 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-57215","post","type-post","status-publish","format-standard","hentry","category-vpn"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/57215","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=57215"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/57215\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=57215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=57215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=57215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}