{"id":274794,"date":"2023-06-23T09:00:22","date_gmt":"2023-06-23T01:00:22","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=274794"},"modified":"2023-06-15T16:24:27","modified_gmt":"2023-06-15T08:24:27","slug":"zlssydwgcjsq","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/zlssydwgcjsq.html","title":{"rendered":"\u5728 Linux \u4e0a\u4f7f\u7528\u7684\u4e94\u4e2a\u8d85\u7ea7\u795e\u5947\u7684 Shell \u522b\u540d"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u60f3\u544a\u8bc9\u4f60\u4e00\u4e9b\u4f5c\u4e3a\u5de5\u7a0b\u5e08\u6211\u6bcf\u5929\u90fd\u5728\u4f7f\u7528\u7684\u7f29\u5199\uff0c\u8fd9\u4e9b\u7f29\u5199\u662f\u7edd\u5bf9\u7684\u751f\u547d\u6551\u661f<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u5145\u5206\u5229\u7528Shell\u7f29\u5199\uff0c\u90a3\u4e48\u4f60\u6b63\u5728\u6d6a\u8d39\u5b9d\u8d35\u7684\u65f6\u95f4\u3002\u4e00\u904d\u53c8\u4e00\u904d\u5730\u91cd\u590d\u8f93\u5165\u76f8\u540c\u7684\u5185\u5bb9\u662f\u65e0\u804a\u3001\u5355\u8c03\u800c\u4e14\u6548\u7387\u4f4e\u4e0b\u7684\u3002\u4e3a\u4ec0\u4e48\u8981\u82b1\u65f6\u95f4\u8bb0\u4f4f\u5197\u957f\u7684\u547d\u4ee4\uff0c\u5f53\u4f60\u53ef\u4ee5\u7b80\u5316\u5b83\u4eec\u5462\uff1f<\/p>\n

\u7f29\u5199\u662f\u7ed9\u547d\u4ee4\u3001\u4e00\u4e32\u547d\u4ee4\u6216\u4e00\u5c0f\u6bb5\u6587\u672c\u8d77\u4e2a\u540d\u5b57\u7684\u65b9\u6cd5\u3002\u4f60\u53ef\u4ee5\u5c06\u591a\u4e2a\u547d\u4ee4\u94fe\u63a5\u5728\u4e00\u8d77\uff0c\u6216\u8005\u5c06\u4e00\u957f\u4e32\u53c2\u6570\u4f20\u9012\u7ed9\u7ecf\u5e38\u4f7f\u7528\u7684\u547d\u4ee4\uff0c\u5e76\u7ed9\u5b83\u8d77\u4e00\u4e2a\u66f4\u77ed\u7684\u540d\u5b57\u3002\u5982\u679c\u4f60\u7ecf\u5e38\u8f93\u5165\u76f8\u540c\u7684\u5185\u5bb9\u5e76\u5e0c\u671b\u7ed9\u5b83\u8d77\u4e00\u4e2a\u66f4\u5bb9\u6613\u8bb0\u4f4f\u7684\u540d\u5b57\uff0c\u8fd9\u975e\u5e38\u6709\u7528\u3002<\/p>\n

\u4f7f\u7528\u7f29\u5199\u53ef\u4ee5\u51cf\u5c11\u8fd0\u884c\u5e38\u7528\u547d\u4ee4\u7684\u65f6\u95f4\u3002\u800c\u4e14\uff0c\u4f60\u518d\u4e5f\u4e0d\u4f1a\u5fd8\u8bb0\u6b63\u786e\u7684\u53c2\u6570\uff0c\u56e0\u4e3a\u4f60\u53ef\u4ee5\u5c06\u5b83\u4eec\u6784\u5efa\u5230\u7f29\u5199\u4e2d\u3002\u5982\u679c\u8bbe\u7f6e\u5f97\u5f53\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u7f29\u5199\u5b9e\u73b0\u4e00\u4e9b\u771f\u6b63\u795e\u5947\u7684\u4e8b\u60c5\u3002<\/p>\n

\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u60f3\u544a\u8bc9\u4f60\u4e00\u4e9b\u4f5c\u4e3a\u5de5\u7a0b\u5e08\u6211\u6bcf\u5929\u90fd\u5728\u4f7f\u7528\u7684\u7f29\u5199\u3002\u8fd9\u4e9b\u7f29\u5199\u662f\u7edd\u5bf9\u7684\u751f\u547d\u6551\u661f\u3002\u5b83\u4eec\u5df2\u7ecf\u6210\u4e3a\u4e86\u808c\u8089\u8bb0\u5fc6\uff0c\u8001\u5b9e\u8bf4\uff0c\u6211\u65e0\u6cd5\u6ca1\u6709\u5b83\u4eec\u751f\u6d3b\u3002<\/p>\n

\"\"<\/p>\n

1\u3001Git status<\/strong><\/div>\n
\r\nalias gg='git status'<\/pre>\n

\u7b80\u5355\uff0c\u662f\u7684\u3002\u9ad8\u6548\uff1f\u4f60\u65e0\u6cd5\u60f3\u8c61\u3002\u5982\u679c\u4f60\u8ba1\u7b97\u4e00\u4e0b\u6bcf\u5929\u8c03\u7528git status\u7684\u6b21\u6570\uff0c\u4f60\u53ef\u80fd\u4f1a\u6709\u4e9b\u9707\u60ca\u3002\u5728Git\u5b58\u50a8\u5e93\u4e2d\uff0c\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u5e38\u89c1\u7684\u547d\u4ee4\u3002\u5b83\u663e\u793a\u4e86\u54ea\u4e9b\u6587\u4ef6\u5df2\u51c6\u5907\u63d0\u4ea4\uff0c\u4f60\u5904\u4e8e\u54ea\u4e2a\u5206\u652f\u4e0a\uff0c\u4ee5\u53ca\u8bb8\u591a\u5176\u4ed6\u6709\u4ef7\u503c\u7684\u4fe1\u606f\u3002<\/p>\n

\u8f93\u5165 git status \u53ef\u80fd\u770b\u8d77\u6765\u5e76\u4e0d\u592a\u75af\u72c2\uff0c\u4f46\u770b\u770b\u5b83\u9700\u8981\u591a\u957f\u65f6\u95f4\uff1f\u770b\u770b\u4f60\u7684\u624b\u6307\u5728\u952e\u76d8\u4e0a\u8df3\u821e\u7684\u65b9\u5f0f\u3002\u6709\u4e00\u4e2a\u7a7a\u683c\uff0c\u5b57\u7b26\u672c\u8eab\u4ee5\u7279\u5b9a\u7684\u6a21\u5f0f\u95f4\u9694\u5f00\uff0c\u5bb9\u6613\u51fa\u9519\u3002\u4e00\u65e6\u641e\u7838\u4e86\uff0c\u4f60\u5c31\u9700\u8981\u91cd\u65b0\u5f00\u59cb\u3002\u6d6a\u8d39\u4e86\u8fd9\u4e48\u591a\u65f6\u95f4\u3002\u53ea\u9700\u8981\u7f29\u5199\u5b83\u3002<\/p>\n

\u8f93\u5165gg\u8981\u5feb\u5f97\u591a\uff0c\u5982\u679c\u4f60\u8f93\u5165\u9519\u8bef\uff0c\u90a3\u4e48\u4e5f\u8bb8\u8003\u8651\u4e00\u4e0b\u6253\u5b57\u8bfe\u7a0b\u2026<\/p>\n

2\u3001\u8fd0\u884cPylint<\/strong><\/div>\n
\r\nalias pll='pylint -f colorized'<\/pre>\n

\u65e0\u8bba\u4f60\u559c\u6b22\u8fd8\u662f\u8ba8\u538c\uff0c\u4ee3\u7801\u68c0\u67e5\u5668\u90fd\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u3002\u4e0d\u7ba1\u4f60\u559c\u4e0d\u559c\u6b22\uff0c\u6ca1\u6709\u4e00\u4e2a\u5de5\u7a0b\u5e08\u662f\u5b8c\u7f8e\u65e0\u7f3a\u7684\u3002\u6211\u4eec\u90fd\u4f1a\u5728\u67d0\u4e2a\u65f6\u523b\u72af\u9519\u8bef\u3002\u4f60\u9700\u8981\u5bf9\u4ee3\u7801\u8fdb\u884c\u68c0\u67e5\uff0c\u56e0\u6b64\u8ba9\u5b83\u53d8\u5f97\u7b80\u5355\u6613\u884c\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002<\/p>\n

\u6211\u5199\u4e86\u5f88\u591aPython\u4ee3\u7801\uff0c\u6240\u4ee5\u6211\u975e\u5e38\u4f9d\u8d56Pylint\u8fdb\u884c\u4ee3\u7801\u68c0\u67e5\u3002\u6211\u4e5f\u559c\u6b22\u4ee5\u5e26\u989c\u8272\u7684\u8f93\u51fa\u65b9\u5f0f\u8fd0\u884cPylint\uff0c\u6709\u65f6\u8fd8\u4f7f\u7528\u5176\u4ed6\u81ea\u5b9a\u4e49\u53c2\u6570\u3002\u4e00\u904d\u53c8\u4e00\u904d\u5730\u952e\u5165\u8fd9\u4e9b\u5185\u5bb9\u5e76\u4e0d\u6709\u8da3\u3002\u5c06\u5176\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7b80\u77ed\u7684\u7f29\u5199\uff0c\u73b0\u5728\u5c31\u66f4\u6709\u8da3\u4e86\u3002<\/p>\n

\u4f60\u53ef\u4ee5\u4f20\u9012\u4e0d\u540c\u7684\u683c\u5f0f\u7c7b\u578b\u3001\u5ffd\u7565\u6587\u4ef6\u3001\u68c0\u67e5\u5668\u4ee5\u53ca\u4e0d\u540c\u7684.rc\u6587\u4ef6\u3002\u57fa\u672c\u4e0a\uff0c\u4efb\u4f55\u4f60\u53ef\u4ee5\u4f20\u9012\u7ed9\u6b63\u5e38\u547d\u4ee4\u7684\u4e1c\u897f\u90fd\u53ef\u4ee5\u653e\u5728\u7f29\u5199\u4e2d\u3002\u8fd9\u5c31\u662f\u5b83\u7684\u5f3a\u5927\u4e4b\u5904\uff0c\u56e0\u4e3a\u4f60\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u559c\u597d\u8bbe\u7f6e\u4ee3\u7801\u68c0\u67e5\u5668\uff0c\u800c\u65e0\u9700\u8bb0\u4f4f\u6216\u91cd\u65b0\u8f93\u5165\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u3002<\/p>\n

3\u3001\u767b\u5f55ECR<\/strong><\/div>\n
\r\nalias ecr_login='aws ecr get-login-password --region  | docker login --username AWS --password-stdin '\r\n<\/ecr_uri><\/region><\/pre>\n

\u5982\u679c\u4f60\u7ecf\u5e38\u4f7f\u7528Docker\u955c\u50cf\u5e76\u4e14\u8fd8\u4f7f\u7528ECR\uff0c\u90a3\u4e48\u8fd9\u4e2a\u522b\u5177\u4e00\u683c\u7684\u547d\u4ee4\u5c06\u4f1a\u6bd4\u9762\u5305\u66f4\u597d\u3002\u767b\u5f55ECR\u975e\u5e38\u7e41\u7410\u3002\u4f60\u5fc5\u987b\u5c06\u6240\u6709\u8fd9\u4e9b\u547d\u4ee4\u8fde\u63a5\u5728\u4e00\u8d77\uff0c\u5e76\u4f7f\u7528\u7279\u5b9a\u7684\u51ed\u636e\u8ba9Docker\u767b\u5f55\u3002\u5982\u679c\u4f60\u4e0d\u8bb0\u5f97\u8be5\u547d\u4ee4\uff0c\u90a3\u771f\u662f\u4e00\u5927\u75db\u82e6\u3002\u7136\u540e\u4f60\u8fd8\u5f97\u53bb\u67e5\u627e\uff0c\u6d6a\u8d39\u5f88\u591a\u65f6\u95f4\u3002<\/p>\n

\u53ea\u9700\u5c06\u767b\u5f55\u547d\u4ee4\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7b80\u6d01\u660e\u4e86\u7684\u522b\u540d\u3002\u5982\u679c\u4f60\u5728\u591a\u4e2aECR\u533a\u57df\u5de5\u4f5c\uff0c\u751a\u81f3\u53ef\u4ee5\u6839\u636e\u533a\u57df\u522b\u540d\u3002\u4e3a\u4e1c\u6d77\u5cb8\u3001\u897f\u6d77\u5cb8\u751a\u81f3\u66f4\u8fdc\u7684\u5730\u65b9\u90fd\u8bbe\u7f6e\u4e00\u4e2a\u767b\u5f55\u522b\u540d\u3002\u4e16\u754c\u5c31\u662f\u4f60\u7684\u6d77\u86ce\uff0c\u73b0\u5728\u4f60\u53ef\u4ee5\u5feb\u901f\u8f7b\u677e\u5730\u767b\u5f55\u3002<\/p>\n

\u4e0d\u8981\u5fd8\u8bb0\u5728\u4e0a\u8ff0\u547d\u4ee4\u4e2d\u6dfb\u52a0\u4f60\u81ea\u5df1\u7684\u533a\u57df\u548cECR URI\uff0c\u4ee5\u4f7f\u5176\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n

4\u3001\u8fd0\u884cAnsible<\/strong><\/div>\n
\r\nalias apb='cd  && ansible-playbook -i <\/inventory_file><\/repo><\/pre>\n

\u5bf9\u6211\u6765\u8bf4\uff0c\u8fd0\u884cAnsible playbooks\u662f\u65e5\u5e38\u5de5\u4f5c\u3002\u6211\u6bcf\u5929\u8fd0\u884c\u591a\u4e2aplay\uff0c\u5e76\u4e14\u7ecf\u5e38\u91cd\u590d\u6267\u884c\u3002\u5c24\u5176\u662f\u5f53\u6211\u6b63\u5728\u6784\u5efa\u65b0\u7684\u89d2\u8272\u6216\u4e0eAnsible\u4e2d\u7684\u6761\u4ef6\u903b\u8f91\u4f5c\u6597\u4e89\u65f6\u3002\u8c01\u4e0d\u559c\u6b22\u5c06YAML\u4f5c\u4e3a\u4ee3\u7801\u5462\uff1f<\/p>\n

\u80fd\u591f\u4f7f\u7528\u6211\u9700\u8981\u7684\u57fa\u672c\u6807\u5fd7\u8fd0\u884cAnsible\u975e\u5e38\u91cd\u8981\u3002\u91cd\u65b0\u8f93\u5165\u4e00\u957f\u4e32\u53c2\u6570\u9700\u8981\u5f88\u957f\u65f6\u95f4\u3002\u5f53\u7136\uff0c\u4f60\u53ef\u4ee5\u6309\u4e0a\u7bad\u5934\u91cd\u7528\u4e4b\u524d\u6267\u884c\u7684\u547d\u4ee4\uff0c\u4f46\u8fd9\u5e76\u4e0d\u603b\u662f\u6700\u65b9\u4fbf\u7684\u9009\u9879\u3002\u5982\u679c\u4f60\u8f6c\u800c\u5207\u6362\u5230\u7f16\u8f91\u6587\u4ef6\uff0c\u73b0\u5728\u53c8\u8981\u6309\u4e24\u6b21\u4e0a\u7bad\u5934\u3002\u8fd9\u5f88\u5bb9\u6613\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u88ab\u5ffd\u7565\uff0c\u7136\u540e\u4f60\u53c8\u5f97\u91cd\u65b0\u8f93\u5165\u4e00\u904d\u3002<\/p>\n

\u53ea\u9700\u7ed9\u5b83\u53d6\u4e2a\u522b\u540d\u3002<\/p>\n

\u8fd9\u8fd8\u53ef\u4ee5\u8ba9\u4f60\u6709\u673a\u4f1a\u786e\u4fdd\u4f60\u662f\u5426\u5728\u4f7f\u7528ansible.cfg\u6587\u4ef6\uff08\u5982\u679c\u6709\u7684\u8bdd\uff09\u3002\u5728\u4e0a\u9762\u7684\u547d\u4ee4\u522b\u540d\u4e2d\uff0c\u6211\u4eec\u8fdb\u5165\u4e86\u6211\u4eec\u7684\u4ed3\u5e93\u5e76\u5728\u8be5\u4e0a\u4e0b\u6587\u4e2d\u8fd0\u884c\u3002\u8fd9\u662f\u56e0\u4e3a\u6211\u4eec\u7684Ansible\u914d\u7f6e\u4f4d\u4e8e\u90a3\u91cc\u3002\u4e00\u65e6\u4f60\u8fdb\u5165\u90a3\u4e2a\u76ee\u5f55\uff0c\u5b83\u4f1a\u81ea\u52a8\u4f7f\u7528\u8be5\u914d\u7f6e\u3002<\/p>\n

\u5982\u679c\u6709\u5176\u4ed6\u7684\u6e05\u5355\u6587\u4ef6\uff0c\u4f60\u4e5f\u53ef\u4ee5\u4f20\u5165\u5b83\u4eec\u3002\u5982\u679c\u4f60\u6709\u4e00\u4e9b\u8de8\u591a\u4e2a\u73af\u5883\u7684\u5168\u5c40\u6e05\u5355\uff0c\u8fd9\u5c06\u975e\u5e38\u6709\u5e2e\u52a9\u3002<\/p>\n

5\u3001\u7f29\u77ed\u5e38\u7528\u547d\u4ee4<\/strong><\/div>\n
\r\nalias tf='terraform'\r\nalias k='kubectl'\r\n<\/pre>\n

\u8fd9\u662f\u6211\u6700\u8fd1\u5f00\u59cb\u5b9e\u65bd\u7684\u6700\u540e\u4e00\u4e2a\u5efa\u8bae\u3002\u8d77\u521d\u6211\u89c9\u5f97\u8fd9\u5e76\u4e0d\u662f\u5fc5\u8981\u7684\uff0c\u4f46\u4e00\u65e6\u4f60\u5f00\u59cb\u4f7f\u7528\u4e00\u4e24\u4e2a\u5b57\u6bcd\u7684\u547d\u4ee4\u800c\u4e0d\u662f\u4e03\u516b\u4e2a\u5b57\u6bcd\u7684\u547d\u4ee4\uff0c\u5c31\u4f1a\u6709\u5f88\u5927\u7684\u4e0d\u540c\u3002\u6211\u6bcf\u5929\u90fd\u7ecf\u5e38\u4f7f\u7528terraform\u548ckubectl\u3002<\/p>\n

\u8fd9\u4e9b\u547d\u4ee4\u662f\u53e6\u4e00\u4e2a\u4f8b\u5b50\uff0c\u5b83\u4eec\u7684\u540d\u79f0\u5f88\u70e6\u4eba\u3002\u5b83\u4eec\u5bb9\u6613\u51fa\u9519\uff0c\u800c\u5c06\u5b83\u4eec\u8bbe\u4e3a\u522b\u540d\u975e\u5e38\u7b80\u5355\u3002\u7ed9\u81ea\u5df1\u4e00\u4e2a\u65b9\u4fbf\uff0c\u73b0\u5728\u5c31\u5c06\u5b83\u4eec\u7f29\u77ed\uff0c\u8fd9\u6837\u4f60\u5c31\u53ef\u4ee5\u5fd8\u8bb0\u5b83\u4eec\u7684\u62fc\u5199\u3002<\/p>\n

\u6211\u8fd8\u9f13\u52b1\u4f60\u67e5\u770b\u5176\u4ed6\u4f60\u7ecf\u5e38\u8f93\u5165\u7684\u5355\u8bcd\u547d\u4ee4\u3002\u53ef\u80fd\u6709\u4e00\u4e9b\u4f60\u4e00\u904d\u53c8\u4e00\u904d\u5730\u8f93\u5165\u7684\u547d\u4ee4\u53ef\u4ee5\u4ece\u7f29\u77ed\u4e2d\u53d7\u76ca\u3002<\/p>\n

\u73b0\u5728\uff0c\u53bb\u7ed9\u547d\u4ee4\u8bbe\u7f6e\u522b\u540d\u5427\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u5145\u5206\u5229\u7528Shell\u7f29\u5199\uff0c\u90a3\u4e48\u4f60\u6b63\u5728\u6d6a\u8d39\u5b9d\u8d35\u7684\u65f6\u95f4\u3002\u4e00\u904d\u53c8\u4e00\u904d\u5730\u91cd\u590d\u8f93\u5165\u76f8\u540c\u7684\u5185\u5bb9\u662f\u65e0\u804a\u3001\u5355\u8c03\u800c\u4e14\u6548 […]<\/p>\n","protected":false},"author":1469,"featured_media":274796,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[21],"tags":[],"class_list":["post-274794","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/274794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=274794"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/274794\/revisions"}],"predecessor-version":[{"id":275033,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/274794\/revisions\/275033"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/274796"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=274794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=274794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=274794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}