{"id":291342,"date":"2024-05-03T22:58:36","date_gmt":"2024-05-03T14:58:36","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=291342"},"modified":"2024-07-16T13:48:37","modified_gmt":"2024-07-16T05:48:37","slug":"learing-linux-04","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/learing-linux-04.html","title":{"rendered":"\u7b2c4\u7ae0 Vim\u7f16\u8f91\u5668\u4e0eShell\u547d\u4ee4\u811a\u672c"},"content":{"rendered":"
\u7ae0\u8282\u7b80\u8ff0\uff1a<\/strong><\/span><\/p>\n \u672c\u7ae0\u9996\u5148\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528Vim\u7f16\u8f91\u5668\u6765\u7f16\u5199\u548c\u4fee\u6539\u6587\u6863\uff0c\u901a\u8fc7\u9010\u6b65\u914d\u7f6e\u4e3b\u673a\u540d\u79f0\u3001\u7cfb\u7edf\u7f51\u5361\u4ee5\u53ca\u8f6f\u4ef6\u4ed3\u5e93\u7b49\u6587\u4ef6\uff0c\u5e2e\u52a9\u5927\u5bb6\u52a0\u6df1\u5bf9Vim\u7f16\u8f91\u5668\u4e2d\u5404\u79cd\u547d\u4ee4\u3001\u5feb\u6377\u952e\u4e0e\u6a21\u5f0f\u7684\u7406\u89e3\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u91cd\u6e29\u7b2c2\u7ae0\u548c\u7b2c3\u7ae0\u4e2d\u7684\u91cd\u70b9\u77e5\u8bc6\uff0c\u5b9e\u73b0Linux\u547d\u4ee4\u3001\u903b\u8f91\u64cd\u4f5c\u7b26\u4e0eShell\u811a\u672c\u7684\u7075\u6d3b\u642d\u914d\u4f7f\u7528\u3002<\/p>\n \u8fd8\u5c06\u6307\u5bfc\u5927\u5bb6\u5982\u4f55\u5728Shell\u811a\u672c\u4e2d\u4ee5\u591a\u79cd\u65b9\u5f0f\u63a5\u6536\u7528\u6237\u8f93\u5165\u7684\u4fe1\u606f\uff0c\u5e76\u5bf9\u8f93\u5165\u503c\u8fdb\u884c\u6587\u4ef6\u3001\u6570\u5b57\u3001\u5b57\u7b26\u4e32\u7684\u5224\u65ad\u548c\u6bd4\u8f83\u3002\u5728\u719f\u7ec3\u638c\u63e1\u201c\u4e0e\u3001\u6216\u3001\u975e\u201d\u4e09\u79cd\u903b\u8f91\u64cd\u4f5c\u7b26\u7684\u57fa\u7840\u4e0a\uff0c\u5927\u5bb6\u5c06\u5b66\u4e60if\u3001for\u3001while\u3001case\u6761\u4ef6\u6d4b\u8bd5\u8bed\u53e5\u3002\u901a\u8fc7\u5341\u591a\u4e2a\u5b9e\u6218\u811a\u672c\u7684\u7ec3\u4e60\uff0c\u5927\u5bb6\u80fd\u591f\u5728\u5de5\u4f5c\u4e2d\u7075\u6d3b\u8fd0\u7528\u8fd9\u4e9b\u77e5\u8bc6\u3002<\/p>\n \u6700\u540e\uff0c\u901a\u8fc7\u5b9e\u6218\u6f14\u793a\u4e86\u5982\u4f55\u4f7f\u7528at\u547d\u4ee4\u4e0ecrond\u8ba1\u5212\u4efb\u52a1\u670d\u52a1\uff0c\u5206\u522b\u5b9e\u73b0\u4e00\u6b21\u6027\u548c\u957f\u671f\u6027\u7684\u7cfb\u7edf\u4efb\u52a1\u8bbe\u7f6e\u3002\u901a\u8fc7\u5728\u5206\u949f\u3001\u5c0f\u65f6\u3001\u65e5\u671f\u3001\u6708\u4efd\u3001\u5e74\u4efd\u7b49\u4e0d\u540c\u57fa\u7840\u4e0a\u7684\u81ea\u52a8\u5316\u8bbe\u7f6e\uff0c\u4ece\u800c\u4f7f\u65e5\u5e38\u5de5\u4f5c\u66f4\u52a0\u9ad8\u6548\uff0c\u8ba9\u5927\u5bb6\u80fd\u65e9\u70b9\u4e0b\u73ed\u966a\u4f34\u5bb6\u4eba\u3002<\/p>\n Vim\u7684\u53d1\u5e03\u6700\u65e9\u53ef\u4ee5\u8ffd\u6eaf\u52301991\u5e74\uff0c\u5176\u82f1\u6587\u5168\u79f0\u4e3aVi Improved\u3002\u5b83\u4e5f\u662fVi\u7f16\u8f91\u5668\u7684\u63d0\u5347\u7248\u672c\uff0c\u5176\u4e2d\u6700\u5927\u7684\u6539\u8fdb\u5f53\u5c5e\u6dfb\u52a0\u4e86\u4ee3\u7801\u7740\u8272\u529f\u80fd\uff0c\u5e76\u5728\u67d0\u4e9b\u7f16\u7a0b\u573a\u666f\u4e0b\u80fd\u591f\u81ea\u52a8\u4fee\u6b63\u9519\u8bef\u4ee3\u7801\u3002 \u6bcf\u5f53\u5728\u8bb2\u8bfe\u65f6\u9047\u5230\u9700\u8981\u8ba9\u5b66\u751f\u8bb0\u4f4f\u7684\u77e5\u8bc6\u70b9\u65f6\uff0c\u4e3a\u4e86\u80fd\u8ba9\u4ed6\u4eec\u6253\u8d77\u7cbe\u795e\u6765\uff0c\u6211\u90fd\u4f1a\u7a81\u7136\u63d0\u9ad8\u55d3\u95e8\uff0c\u56e0\u6b64\u6709\u53e5\u8bdd\u4ed6\u4eec\u8bb0\u5f97\u5c24\u5176\u6df1\u523b\uff1a\u201c\u5728Linux\u7cfb\u7edf\u4e2d\u4e00\u5207\u90fd\u662f\u6587\u4ef6\uff0c\u800c\u914d\u7f6e\u4e00\u4e2a\u670d\u52a1\u5c31\u662f\u5728\u4fee\u6539\u5176\u914d\u7f6e\u6587\u4ef6\u7684\u53c2\u6570\u3002<\/strong>\u201d\u5728\u65e5\u5e38\u5de5\u4f5c\u4e2d\uff0c\u5927\u5bb6\u80af\u5b9a\u4e5f\u514d\u4e0d\u4e86\u8981\u7f16\u5199\u6587\u6863\uff0c\u8fd9\u4e9b\u5de5\u4f5c\u90fd\u662f\u901a\u8fc7\u6587\u672c\u7f16\u8f91\u5668\u6765\u5b8c\u6210\u7684\u3002\u5218\u9044\u8001\u5e08\u5199\u4f5c\u672c\u4e66\u7684\u76ee\u7684\u662f\u8ba9\u8bfb\u8005\u5207\u5b9e\u638c\u63e1Linux\u7cfb\u7edf\u7684\u8fd0\u7ef4\u65b9\u6cd5\uff0c\u800c\u4e0d\u662f\u4ec5\u4ec5\u505c\u7559\u5728\u201c\u4f1a\u7528\u67d0\u4e2a\u64cd\u4f5c\u7cfb\u7edf\u201d\u7684\u5c42\u9762\u4e0a\uff0c\u56e0\u6b64\uff0c\u6211\u4eec\u9009\u62e9\u4f7f\u7528Vim\u6587\u672c\u7f16\u8f91\u5668\uff0c\u5b83\u9ed8\u8ba4\u5b89\u88c5\u5728\u6240\u6709\u7684Linux\u64cd\u4f5c\u7cfb\u7edf\u4e0a\uff0c\u662f\u4e00\u6b3e\u6781\u4e3a\u4f18\u79c0\u7684\u6587\u672c\u7f16\u8f91\u5668\u3002<\/p>\n Vim\u4e4b\u6240\u4ee5\u80fd\u5f97\u5230\u5e7f\u5927\u5382\u5546\u4e0e\u7528\u6237\u7684\u8ba4\u53ef\uff0c\u539f\u56e0\u5728\u4e8eVim\u7f16\u8f91\u5668\u4e2d\u8bbe\u7f6e\u4e86\u4e09\u79cd\u6a21\u5f0f\u2014\u2014\u547d\u4ee4\u6a21\u5f0f\u3001\u672b\u884c\u6a21\u5f0f\u548c\u7f16\u8f91\u6a21\u5f0f\uff0c\u6bcf\u79cd\u6a21\u5f0f\u5206\u522b\u652f\u6301\u591a\u79cd\u4e0d\u540c\u7684\u547d\u4ee4\u5feb\u6377\u952e\uff0c\u5927\u5927\u63d0\u9ad8\u4e86\u5de5\u4f5c\u6548\u7387\u3002\u7528\u6237\u4e60\u60ef\u540e\u4f1a\u89c9\u5f97\u975e\u5e38\u987a\u624b\u3002\u8981\u60f3\u9ad8\u6548\u5730\u64cd\u4f5c\u6587\u672c\uff0c\u5c31\u5fc5\u987b\u5148\u641e\u6e05\u8fd9\u4e09\u79cd\u6a21\u5f0f\u7684\u64cd\u4f5c\u533a\u522b\u4ee5\u53ca\u6a21\u5f0f\u4e4b\u95f4\u7684\u5207\u6362\u65b9\u6cd5\uff08\u89c1\u56fe4-1\uff09\u3002<\/p>\n \u547d\u4ee4\u6a21\u5f0f<\/strong>\uff1a\u63a7\u5236\u5149\u6807\u79fb\u52a8\uff0c\u53ef\u5bf9\u6587\u672c\u8fdb\u884c\u590d\u5236\u3001\u7c98\u8d34\u3001\u5220\u9664\u548c\u67e5\u627e\u7b49\u5de5\u4f5c\u3002<\/p>\n \u8f93\u5165\u6a21\u5f0f<\/strong>\uff1a\u6b63\u5e38\u7684\u6587\u672c\u5f55\u5165\u3002<\/p>\n \u672b\u884c\u6a21\u5f0f<\/strong>\uff1a\u4fdd\u5b58\u6216\u9000\u51fa\u6587\u6863\uff0c\u4ee5\u53ca\u8bbe\u7f6e\u7f16\u8f91\u73af\u5883\u3002<\/p><\/blockquote>\n <\/p>\n \u56fe4-1\u00a0 Vim\u7f16\u8f91\u5668\u6a21\u5f0f\u7684\u5207\u6362\u65b9\u6cd5<\/p>\n \u6bcf\u6b21\u8fd0\u884cVim\u7f16\u8f91\u5668\u65f6\uff0c\u9ed8\u8ba4\u8fdb\u5165\u547d\u4ee4\u6a21\u5f0f\uff0c\u6b64\u65f6\u9700\u8981\u5148\u5207\u6362\u5230\u8f93\u5165\u6a21\u5f0f\u540e\u518d\u8fdb\u884c\u6587\u6863\u7f16\u5199\u5de5\u4f5c\u3002\u5728\u7f16\u5199\u5b8c\u6587\u6863\u540e\uff0c\u9700\u8981\u5148\u8fd4\u56de\u547d\u4ee4\u6a21\u5f0f\uff0c\u7136\u540e\u518d\u8fdb\u5165\u672b\u884c\u6a21\u5f0f\uff0c\u6267\u884c\u6587\u6863\u7684\u4fdd\u5b58\u6216\u9000\u51fa\u64cd\u4f5c\u3002\u5728Vim\u4e2d\uff0c\u65e0\u6cd5\u76f4\u63a5\u4ece\u8f93\u5165\u6a21\u5f0f\u5207\u6362\u5230\u672b\u884c\u6a21\u5f0f\u3002Vim\u7f16\u8f91\u5668\u4e2d\u5185\u7f6e\u4e86\u6210\u767e\u4e0a\u5343\u79cd\u547d\u4ee4\uff0c\u4e3a\u4e86\u5e2e\u52a9\u8bfb\u8005\u66f4\u5feb\u5730\u638c\u63e1Vim\u7f16\u8f91\u5668\uff0c\u88684-1\u603b\u7ed3\u4e86\u547d\u4ee4\u6a21\u5f0f\u4e2d\u6700\u5e38\u7528\u7684\u4e00\u4e9b\u547d\u4ee4\u3002<\/p>\n \u88684-1\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u547d\u4ee4\u6a21\u5f0f\u4e2d\u6700\u5e38\u7528\u7684\u4e00\u4e9b\u547d\u4ee4<\/p>\n <\/p>\n \u672b\u884c\u6a21\u5f0f\u4e3b\u8981\u7528\u4e8e\u4fdd\u5b58\u6216\u9000\u51fa\u6587\u4ef6\uff0c\u4ee5\u53ca\u8bbe\u7f6eVim\u7f16\u8f91\u5668\u7684\u5de5\u4f5c\u73af\u5883\uff0c\u8fd8\u80fd\u591f\u8ba9\u7528\u6237\u6267\u884c\u5916\u90e8\u7684Linux\u547d\u4ee4\u6216\u8df3\u8f6c\u5230\u6240\u7f16\u5199\u6587\u6863\u7684\u7279\u5b9a\u884c\u6570\u3002\u8981\u60f3\u5207\u6362\u5230\u672b\u884c\u6a21\u5f0f\uff0c\u5728\u547d\u4ee4\u6a21\u5f0f\u4e2d\u8f93\u5165\u4e00\u4e2a\u5192\u53f7\u5c31\u53ef\u4ee5\u4e86\u3002\u672b\u884c\u6a21\u5f0f\u4e2d\u5e38\u7528\u7684\u547d\u4ee4\u5982\u88684-2\u6240\u793a\u3002<\/p>\n \u88684-2 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u672b\u884c\u6a21\u5f0f\u4e2d\u6700\u5e38\u7528\u7684\u4e00\u4e9b\u547d\u4ee4<\/p>\n <\/p>\n \u5927\u5bb6\u5728\u5e73\u65e5\u91cc\u4e00\u5b9a\u8981\u591a\u4f7f\u7528Vim\u7f16\u8f91\u5668\uff0c\u4e00\u65e6\u628aVim\u7684\u5404\u79cd\u547d\u4ee4\u7ec3\u719f\uff0c\u540e\u9762\u5728\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\u65f6\uff0c\u6548\u7387\u5c31\u4f1a\u6709\u5f88\u5927\u7684\u63d0\u5347\u3002\u57282011\u5e74\uff0c\u6709\u4e00\u4f4d\u540d\u4e3aAleksandr Levchuk\u7684\u6781\u5ba2\uff0c\u4ed6\u5c31\u4e3a\u4e86\u8ffd\u6c42\u6781\u81f4\u7684\u6548\u7387\uff0c\u53d1\u8d77\u4e86\u4e00\u4e2a\u540d\u4e3aVIM Clutch\u7684\u5b9e\u9a8c\u9879\u76ee\u3002\u4ed6\u4e70\u4e86\u4e00\u5bf9\u7c7b\u4f3c\u4e8e\u6c7d\u8f66\u6cb9\u95e8\u548c\u5239\u8f66\u7684\u79bb\u5408\u5668\uff0c\u6539\u88c5\u540e\u518d\u7528USB\u4e0e\u7535\u8111\u76f8\u8fde\uff0c\u5de6\u811a\u8e29\u5239\u8f66\u662f\u8fdb\u5165\u7f16\u8f91\u6a21\u5f0f\uff08i\uff09\uff0c\u53f3\u811a\u8e29\u6cb9\u95e8\u662f\u4fdd\u5b58\u6587\u4ef6\uff08wq!\uff09\u3002\u4ed6\u5bf9Linux\u548cVim\u7684\u70ed\u7231\u771f\u662f\u5f3a\u5927\uff01<\/p>\n \u76ee\u524d\u4e3a\u6b62\uff0c\u5927\u5bb6\u5df2\u7ecf\u5177\u5907\u4e86\u5728Linux\u7cfb\u7edf\u4e2d\u7f16\u5199\u6587\u6863\u7684\u7406\u8bba\u57fa\u7840\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u4e00\u8d77\u52a8\u624b\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u811a\u672c\u6587\u6863\u3002\u5218\u9044\u8001\u5e08\u4f1a\u5c3d\u529b\u628a\u6240\u6709\u64cd\u4f5c\u6b65\u9aa4\u548c\u6309\u952e\u8fc7\u7a0b\u90fd\u6807\u6ce8\u51fa\u6765\uff0c\u5982\u679c\u5fd8\u8bb0\u4e86\u67d0\u4e9b\u5feb\u6377\u952e\u547d\u4ee4\u7684\u4f5c\u7528\uff0c\u53ef\u4ee5\u518d\u8fd4\u56de\u524d\u6587\u8fdb\u884c\u590d\u4e60\u3002<\/p>\n \u7f16\u5199\u811a\u672c\u6587\u6863\u7684\u7b2c\u4e00\u6b65\u5c31\u662f\u7ed9\u6587\u6863\u53d6\u4e2a\u540d\u5b57\uff0c\u8fd9\u91cc\u5c06\u5176\u547d\u540d\u4e3apractice.txt\u3002\u5982\u679c\u8be5\u6587\u6863\u5b58\u5728\uff0c\u5219\u6253\u5f00\u5b83\uff1b\u5982\u679c\u4e0d\u5b58\u5728\uff0c\u5219\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u7684\u8f93\u5165\u6587\u4ef6\uff0c\u5982\u56fe4-2\u6240\u793a\u3002<\/p>\n <\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-2\u00a0 \u5c1d\u8bd5\u7f16\u5199\u6587\u672c\u6587\u6863<\/p>\n \u6253\u5f00practice.txt\u6587\u6863\u540e\uff0c\u9ed8\u8ba4\u8fdb\u5165\u7684\u662fVim\u7f16\u8f91\u5668\u7684\u547d\u4ee4\u6a21\u5f0f\u3002\u6b64\u65f6\u53ea\u80fd\u6267\u884c\u547d\u4ee4\u6a21\u5f0f\u4e0b\u7684\u547d\u4ee4\uff0c\u800c\u4e0d\u80fd\u968f\u610f\u8f93\u5165\u6587\u672c\u5185\u5bb9\uff0c\u6211\u4eec\u9700\u8981\u5207\u6362\u5230\u8f93\u5165\u6a21\u5f0f\u624d\u80fd\u7f16\u5199\u6587\u6863\u3002<\/p>\n \u5728\u56fe4-1\u4e2d\u63d0\u5230\uff0c\u53ef\u4ee5\u5206\u522b\u4f7f\u7528a\u3001i\u3001o\u4e09\u4e2a\u952e\u4ece\u547d\u4ee4\u6a21\u5f0f\u5207\u6362\u5230\u8f93\u5165\u6a21\u5f0f\u3002\u5176\u4e2d\uff0ca\u952e\u4e0ei\u952e\u5206\u522b\u662f\u5728\u5149\u6807\u540e\u9762\u4e00\u4f4d\u548c\u5149\u6807\u5f53\u524d\u4f4d\u7f6e\u5207\u6362\u5230\u8f93\u5165\u6a21\u5f0f\uff0c\u800co\u952e\u5219\u662f\u5728\u5149\u6807\u7684\u4e0b\u9762\u518d\u521b\u5efa\u4e00\u4e2a\u7a7a\u884c\u3002\u6b64\u65f6\u53ef\u6572\u51fbi\u952e\u8fdb\u5165\u5230\u7f16\u8f91\u5668\u7684\u8f93\u5165\u6a21\u5f0f\uff0c\u5982\u56fe4-3\u6240\u793a\u3002<\/p>\n <\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-3\u00a0 \u5207\u6362\u81f3\u7f16\u8f91\u5668\u7684\u8f93\u5165\u6a21\u5f0f<\/p>\n \u8fdb\u5165\u5230\u8f93\u5165\u6a21\u5f0f\u540e\uff0c\u53ef\u4ee5\u968f\u610f\u8f93\u5165\u6587\u672c\u5185\u5bb9\uff0cVim\u7f16\u8f91\u5668\u4e0d\u4f1a\u628a\u60a8\u8f93\u5165\u7684\u6587\u672c\u5185\u5bb9\u5f53\u4f5c\u547d\u4ee4\u800c\u6267\u884c\uff0c\u5982\u56fe4-4\u6240\u793a\u3002<\/p>\n <\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-4\u00a0 \u5728\u7f16\u8f91\u5668\u4e2d\u8f93\u5165\u6587\u672c\u5185\u5bb9<\/p>\n \u5728\u7f16\u5199\u5b8c\u4e4b\u540e\uff0c\u8981\u60f3\u4fdd\u5b58\u5e76\u9000\u51fa\uff0c\u5fc5\u987b\u5148\u6572\u51fb\u952e\u76d8\u7684Esc\u952e\u4ece\u8f93\u5165\u6a21\u5f0f\u8fd4\u56de\u547d\u4ee4\u6a21\u5f0f\uff0c\u5982\u56fe4-5\u6240\u793a\u3002\u7136\u540e\u518d\u8f93\u5165\u201c:wq!\u201d\u5207\u6362\u5230\u672b\u884c\u6a21\u5f0f\u624d\u80fd\u5b8c\u6210\u4fdd\u5b58\u9000\u51fa\u64cd\u4f5c\uff0c\u5982\u56fe4-6\u6240\u793a\u3002<\/p>\n <\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-5 \u5207\u6362\u81f3\u7f16\u8f91\u5668\u7684\u547d\u4ee4\u6a21\u5f0f<\/p>\n <\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-6 \u5207\u6362\u81f3\u7f16\u8f91\u5668\u7684\u672b\u884c\u6a21\u5f0f<\/p>\n \u5f53\u5728\u672b\u884c\u6a21\u5f0f\u4e2d\u8f93\u5165\u201c:wq!\u201d\u547d\u4ee4\u65f6\uff0c\u5c31\u610f\u5473\u7740\u5f3a\u5236\u4fdd\u5b58\u5e76\u9000\u51fa\u6587\u6863\u3002\u7136\u540e\u4fbf\u53ef\u4ee5\u7528cat\u547d\u4ee4\u67e5\u770b\u4fdd\u5b58\u540e\u7684\u6587\u6863\u5185\u5bb9\u4e86\uff0c\u5982\u56fe4-7\u6240\u793a\u3002<\/p>\n <\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-7 \u67e5\u770b\u6587\u6863\u7684\u5185\u5bb9<\/p>\n \u662f\u4e0d\u662f\u5f88\u7b80\u5355\uff1f\uff01\u7ee7\u7eed\u7f16\u8f91\u8fd9\u4e2a\u6587\u6863\u3002\u56e0\u4e3a\u8981\u5728\u539f\u6709\u6587\u672c\u5185\u5bb9\u7684\u4e0b\u9762\u8ffd\u52a0\u5185\u5bb9\uff0c\u6240\u4ee5\u5728\u547d\u4ee4\u6a21\u5f0f\u4e2d\u6572\u51fbo\u952e\u8fdb\u5165\u8f93\u5165\u6a21\u5f0f\u66f4\u4f1a\u9ad8\u6548\uff0c\u64cd\u4f5c\u5982\u56fe4-8\uff5e\u56fe4-10\u6240\u793a\u3002<\/p>\n <\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-8\u00a0 \u518d\u6b21\u901a\u8fc7Vim\u7f16\u8f91\u5668\u7f16\u5199\u6587\u6863<\/p>\n <\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-9\u00a0 \u8fdb\u5165Vim\u7f16\u8f91\u5668\u7684\u8f93\u5165\u6a21\u5f0f<\/p>\n <\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-10\u00a0 \u8ffd\u52a0\u5199\u5165\u4e00\u884c\u6587\u672c\u5185\u5bb9<\/p>\n \u56e0\u4e3a\u6b64\u65f6\u5df2\u7ecf\u4fee\u6539\u4e86\u6587\u672c\u5185\u5bb9\uff0c\u6240\u4ee5Vim\u7f16\u8f91\u5668\u5728\u5c1d\u8bd5\u76f4\u63a5\u9000\u51fa\u6587\u6863\u800c\u4e0d\u4fdd\u5b58\u7684\u65f6\u5019\u5c31\u4f1a\u62d2\u7edd\u6211\u4eec\u7684\u64cd\u4f5c\u4e86\u3002\u6b64\u65f6\u53ea\u80fd\u5f3a\u5236\u9000\u51fa\u624d\u80fd\u7ed3\u675f\u672c\u6b21\u8f93\u5165\u64cd\u4f5c\uff0c\u5982\u56fe4-11\uff5e\u56fe4-13\u6240\u793a\u3002<\/p>\n <\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-11\u00a0 \u9000\u51fa\u6587\u672c\u7f16\u8f91\u5668<\/p>\n <\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-12\u00a0 \u56e0\u6587\u4ef6\u5df2\u88ab\u4fee\u6539\u800c\u62d2\u7edd\u9000\u51fa\u64cd\u4f5c<\/p>\n <\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-13 \u00a0\u5f3a\u5236\u9000\u51fa\u6587\u672c\u7f16\u8f91\u5668<\/p>\n \u73b0\u5728\u5927\u5bb6\u4e5f\u7b97\u662f\u5177\u5907\u4e86\u4e00\u4e9bVim\u7f16\u8f91\u5668\u7684\u5b9e\u6218\u7ecf\u9a8c\u4e86\uff0c\u5e94\u8be5\u4e5f\u611f\u89c9\u5230\u6ca1\u6709\u60f3\u8c61\u4e2d\u90a3\u4e48\u96be\u5427\u3002\u73b0\u5728\u67e5\u770b\u6587\u672c\u7684\u5185\u5bb9\uff0c\u53d1\u73b0\u8ffd\u52a0\u8f93\u5165\u7684\u5185\u5bb9\u5e76\u6ca1\u6709\u88ab\u4fdd\u5b58\u4e0b\u6765\uff0c\u5982\u56fe4-14\u6240\u793a\u3002<\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u56fe4-14 \u00a0\u67e5\u770b\u6700\u7ec8\u7f16\u5199\u6210\u7684\u6587\u672c\u5185\u5bb9<\/p>\n \u5927\u5bb6\u5728\u5b66\u5b8c\u4e86\u7406\u8bba\u77e5\u8bc6\u4e4b\u540e\u53c8\u81ea\u5df1\u52a8\u624b\u7f16\u5199\u4e86\u4e00\u4e2a\u6587\u672c\uff0c\u73b0\u5728\u662f\u5426\u611f\u89c9\u6210\u5c31\u611f\u6ee1\u6ee1\u5462\uff1f\u63a5\u4e0b\u6765\u5c06\u4f1a\u7531\u6d45\u5165\u6df1\u5730\u4e3a\u8bfb\u8005\u5b89\u63923\u4e2a\u5c0f\u4efb\u52a1\u3002\u4e3a\u4e86\u5f7b\u5e95\u638c\u63e1Vim\u7f16\u8f91\u5668\u7684\u4f7f\u7528\uff0c\u5927\u5bb6\u4e00\u5b9a\u8981\u9010\u4e2a\u5b8c\u6210\uff0c\u4e0d\u8bb8\u5077\u61d2\u3002\u5982\u679c\u5728\u5b8c\u6210\u8fd93\u4e2a\u4efb\u52a1\u671f\u95f4\u5fd8\u8bb0\u4e86\u76f8\u5173\u547d\u4ee4\uff0c\u53ef\u8fd4\u56de\u524d\u6587\u8fdb\u4e00\u6b65\u590d\u4e60\u638c\u63e1\u3002<\/p>\n \u4e3a\u4e86\u4fbf\u4e8e\u5728\u5c40\u57df\u7f51\u4e2d\u67e5\u627e\u7279\u5b9a\u7684\u4e3b\u673a\u6216\u533a\u5206\u4e3b\u673a\uff0c\u9664\u4e86\u9700\u8981\u6709IP\u5730\u5740\u5916\uff0c\u8fd8\u9700\u8981\u4e3a\u4e3b\u673a\u914d\u7f6e\u4e00\u4e2a\u4e3b\u673a\u540d\uff0c\u4e3b\u673a\u4e4b\u95f4\u53ef\u4ee5\u901a\u8fc7\u8fd9\u4e2a\u7c7b\u4f3c\u4e8e\u57df\u540d\u7684\u540d\u79f0\u6765\u76f8\u4e92\u8bbf\u95ee\u3002\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u4e3b\u673a\u540d\u5927\u591a\u4fdd\u5b58\u5728\/etc\/hostname\u6587\u4ef6\u4e2d\uff0c\u63a5\u4e0b\u6765\u5c06\/etc\/hostname\u914d\u7f6e\u6587\u4ef6\u7684\u5185\u5bb9\u4fee\u6539\u4e3a\u201clrxjmw.cn\u201d\uff0c\u6b65\u9aa4\u5982\u4e0b\u3002<\/p>\n \u7b2c1\u6b65\uff1a<\/strong>\u4f7f\u7528Vim\u7f16\u8f91\u5668\u6253\u5f00\u5e76\u4fee\u6539\/etc\/hostname\u6587\u4ef6\u4e2d\u7684\u4e3b\u673a\u540d\u79f0\u3002<\/p>\n \u7b2c2\u6b65<\/strong>\uff1a\u5220\u9664\u539f\u59cb\u4e3b\u673a\u540d\u79f0\uff0c\u7136\u540e\u6dfb\u52a0\u201clrxjmw.cn\u201d\u3002\u6ce8\u610f\uff0c\u4f7f\u7528Vim\u7f16\u8f91\u5668\u4fee\u6539\u4e3b\u673a\u540d\u79f0\u6587\u4ef6\u540e\uff0c\u8981\u5728\u672b\u884c\u6a21\u5f0f\u4e0b\u6267\u884c\u201c:wq!\u201d\u547d\u4ee4\u624d\u80fd\u4fdd\u5b58\u5e76\u9000\u51fa\u6587\u6863\u3002<\/p>\n \u7b2c3\u6b65<\/strong>\uff1a\u4fdd\u5b58\u5e76\u9000\u51fa\u6587\u6863\uff0c\u7136\u540e\u4f7f\u7528hostname\u547d\u4ee4\u68c0\u67e5\u662f\u5426\u4fee\u6539\u6210\u529f\u3002<\/p><\/blockquote>\n hostname\u547d\u4ee4\u7528\u4e8e\u67e5\u770b\u5f53\u524d\u7684\u4e3b\u673a\u540d\u79f0\u3002\u4f46\u6709\u65f6\u4fee\u6539\u4e0d\u4f1a\u7acb\u5373\u751f\u6548\uff0c\u56e0\u6b64\uff0c\u5982\u679c\u53d1\u73b0\u4fee\u6539\u5b8c\u6210\u540e\u4ecd\u663e\u793a\u539f\u6765\u7684\u4e3b\u673a\u540d\u79f0\uff0c\u53ef\u91cd\u542f\u865a\u62df\u673a\u540e\u518d\u67e5\u770b\uff1a<\/p>\n \u7f51\u5361IP\u5730\u5740\u914d\u7f6e\u7684\u662f\u5426\u6b63\u786e\u662f\u4e24\u53f0\u670d\u52a1\u5668\u662f\u5426\u80fd\u591f\u76f8\u4e92\u901a\u4fe1\u7684\u524d\u63d0\u3002\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u4e00\u5207\u90fd\u662f\u6587\u4ef6\uff0c\u56e0\u6b64\u914d\u7f6e\u7f51\u7edc\u670d\u52a1\u7684\u5de5\u4f5c\u5b9e\u8d28\u5c31\u662f\u5728\u7f16\u8f91\u7f51\u5361\u914d\u7f6e\u6587\u4ef6\u3002\u8fd9\u4e2a\u5c0f\u4efb\u52a1\u4e0d\u4ec5\u53ef\u4ee5\u5e2e\u52a9\u60a8\u7ec3\u4e60\u4f7f\u7528Vim\u7f16\u8f91\u5668\uff0c\u800c\u4e14\u4e5f\u4e3a\u540e\u9762\u5b66\u4e60Linux\u4e2d\u7684\u5404\u79cd\u670d\u52a1\u914d\u7f6e\u5960\u5b9a\u4e86\u575a\u5b9e\u57fa\u7840\u3002\u5f53\u60a8\u8ba4\u771f\u5b66\u4e60\u5b8c\u672c\u4e66\u540e\uff0c\u4e00\u5b9a\u4f1a\u7279\u522b\u6709\u6210\u5c31\u611f\uff0c\u56e0\u4e3a\u672c\u4e66\u524d\u9762\u7684\u57fa\u7840\u90e8\u5206\u975e\u5e38\u624e\u5b9e\uff0c\u800c\u540e\u9762\u5185\u5bb9\u5219\u5177\u6709\u51e0\u4e4e\u4e00\u81f4\u7684\u7f51\u5361IP\u5730\u5740\u548c\u8fd0\u884c\u73af\u5883\uff0c\u4ece\u800c\u786e\u4fdd\u8bfb\u8005\u5168\u8eab\u5fc3\u5730\u6295\u5165\u5230\u5404\u7c7b\u670d\u52a1\u7a0b\u5e8f\u7684\u5b66\u4e60\u4e0a\uff0c\u800c\u4e0d\u5fc5\u64cd\u5fc3\u7cfb\u7edf\u73af\u5883\u7684\u95ee\u9898\u3002<\/p>\n \u5982\u679c\u60a8\u5177\u5907\u4e00\u5b9a\u7684\u8fd0\u7ef4\u7ecf\u9a8c\u6216\u8005\u719f\u6089\u65e9\u671f\u7684Linux\u7cfb\u7edf\uff0c\u5219\u5728\u5b66\u4e60\u672c\u4e66\u65f6\u4f1a\u9047\u5230\u4e00\u4e9b\u4e0d\u5bb9\u6613\u63a5\u53d7\u7684\u5dee\u5f02\u53d8\u5316\u3002\u5728RHEL 5\u3001RHEL 6\u4e2d\uff0c\u7f51\u5361\u914d\u7f6e\u6587\u4ef6\u7684\u524d\u7f00\u4e3aeth\uff0c\u7b2c1\u5757\u7f51\u5361\u4e3aeth0\uff0c\u7b2c2\u5757\u7f51\u5361\u4e3aeth1\uff1b\u4ee5\u6b64\u7c7b\u63a8\u3002\u5728RHEL 7\u4e2d\uff0c\u7f51\u5361\u914d\u7f6e\u6587\u4ef6\u7684\u524d\u7f00\u5219\u4ee5ifcfg\u5f00\u59cb\uff0c\u518d\u52a0\u4e0a\u7f51\u5361\u540d\u79f0\u5171\u540c\u7ec4\u6210\u4e86\u7f51\u5361\u914d\u7f6e\u6587\u4ef6\u7684\u540d\u5b57\uff0c\u4f8b\u5982ifcfg-eno16777736\u3002\u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u800c\u5728RHEL 8\u30019\u300110\u4e2d\uff0c\u7f51\u5361\u540d\u79f0\u6539\u6210\u4e86\u7c7b\u4f3c\u4e8eens160\u7684\u6837\u5b50\uff0c\u4e0d\u8fc7\u597d\u5728\u9664\u4e86\u6587\u4ef6\u540d\u53d1\u751f\u53d8\u5316\u5916\uff0c\u7f51\u5361\u53c2\u6570\u6ca1\u6709\u5176\u5b83\u5927\u7684\u533a\u522b\u3002<\/p>\n \u73b0\u5728\u6709\u4e00\u4e2a\u540d\u79f0\u4e3aens160\u7684\u7f51\u5361\u8bbe\u5907\uff0c\u5c06\u5176\u914d\u7f6e\u4e3a\u5f00\u673a\u81ea\u542f\u52a8\uff0c\u5e76\u4e14IP\u5730\u5740\u3001\u5b50\u7f51\u3001\u7f51\u5173\u7b49\u4fe1\u606f\u7531\u4eba\u5de5\u6307\u5b9a\uff0c\u5176\u6b65\u9aa4\u5982\u4e0b\u6240\u793a\u3002<\/p>\n \u7b2c1\u6b65<\/strong>\uff1a\u3010\u6539\u6539\u6539\u3011<\/span><\/strong>\u9996\u5148\u5207\u6362\u5230\/etc\/NetworkManager\/system-connections\/\u76ee\u5f55\u4e2d\uff0c\u8fd9\u91cc\u5b58\u653e\u7740\u6240\u6709\u7684\u7f51\u5361\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n \u7b2c2\u6b65<\/strong>\uff1a\u4f7f\u7528Vim\u7f16\u8f91\u5668\u4fee\u6539\u7f51\u5361\u6587\u4ef6ens160.nmconnection\uff0c\u9010\u9879\u5199\u5165\u4e0b\u9762\u7684\u914d\u7f6e\u53c2\u6570\u5e76\u4fdd\u5b58\u9000\u51fa\uff08\u4e2d\u6587\u662f\u7ed9\u5927\u5bb6\u7684\u6ce8\u91ca\uff0c\u4e0d\u8981\u5199\u8fdb\u53bb\u54e6\uff09\u3002\u7531\u4e8e\u6bcf\u53f0\u8bbe\u5907\u7684\u786c\u4ef6\u53ca\u67b6\u6784\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u56e0\u6b64\u8bf7\u8bfb\u8005\u4f7f\u7528ifconfig\u547d\u4ee4\u81ea\u884c\u786e\u8ba4\u5404\u81ea\u7f51\u5361\u7684\u9ed8\u8ba4\u540d\u79f0\u3002<\/p>\n \u3010\u6539\u6539\u6539\u3011<\/span><\/strong>[connection]<\/p>\n \u7f51\u5361ID<\/strong>\uff1aid=ens160<\/p>\n \u8bbe\u5907\u7c7b\u578b<\/strong>\uff1atype=ethernet<\/p>\n \u7f51\u5361\u540d\u79f0<\/strong>\uff1ainterface-name=ens160<\/p>\n \u5f00\u673a\u81ea\u542f\u52a8\uff1a<\/strong>autoconnect=true<\/p>\n [ipv4]<\/p>\n IP\u5730\u5740\u4e0e\u5b50\u7f51\u63a9\u7801<\/strong>\uff1aaddress1=192.168.10.10\/24<\/p>\n \u5730\u5740\u5206\u914d\u6a21\u5f0f<\/strong>\uff1amethod=manual<\/p>\n \u7f51\u5173\u5730\u5740<\/strong>\uff1agateway=192.168.10.10<\/p>\n DNS\u5730\u5740<\/strong>\uff1adns=192.168.10.10<\/p><\/blockquote>\n \u7b2c3\u6b65<\/strong>\uff1a\u91cd\u542f\u7f51\u7edc\u670d\u52a1\u5e76\u6d4b\u8bd5\u7f51\u7edc\u662f\u5426\u8fde\u901a\u3002<\/p>\n \u5f00\u59cb\u5b9e\u6218\uff01<\/p>\n \u8fdb\u5165\u5230\u7f51\u5361\u914d\u7f6e\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\uff0c\u7136\u540e\u7f16\u8f91\u7f51\u5361\u914d\u7f6e\u6587\u4ef6\uff0c\u5728\u5176\u4e2d\u586b\u5165\u4e0b\u9762\u7684\u4fe1\u606f\uff1a<\/p>\n \u6267\u884c\u91cd\u542f\u7f51\u5361\u8bbe\u5907\u7684\u547d\u4ee4\uff0c\u7136\u540e\u901a\u8fc7ping\u547d\u4ee4\u6d4b\u8bd5\u7f51\u7edc\u80fd\u5426\u8fde\u901a\u3002\u7531\u4e8e\u5728Linux\u7cfb\u7edf\u4e2dping\u547d\u4ee4\u4e0d\u4f1a\u81ea\u52a8\u7ec8\u6b62\uff0c\u56e0\u6b64\u9700\u8981\u624b\u52a8\u6309\u4e0bCtrl+C\u7ec4\u5408\u952e\u6765\u5f3a\u884c\u7ed3\u675f\u8fdb\u7a0b\u3002<\/p>\n \u662f\u4e0d\u662f\u611f\u89c9\u5f88\u6709\u610f\u601d\uff1f\uff01\u5f53\u7136\u5982\u679c\u8fd9\u4e2a\u5b9e\u9a8c\u5931\u8d25\u4e86\u4e5f\u4e0d\u7528\u6c14\u9981\uff0c\u540e\u9762\u4f1a\u6709\u76f8\u5e94\u7684\u7ae0\u8282\u4e13\u95e8\u8bb2\u89e3\uff0c\u8bf7\u5927\u5bb6\u628a\u5173\u6ce8\u70b9\u7ee7\u7eed\u653e\u56de\u5230Vim\u7f16\u8f91\u5668\u4e0a\u5c31\u597d\u3002<\/p>\n \u672c\u4e66\u524d\u9762\u8bb2\u5230\uff0c\u8f6f\u4ef6\u4ed3\u5e93\u662f\u4e00\u79cd\u80fd\u8fdb\u4e00\u6b65\u7b80\u5316RPM\u7ba1\u7406\u8f6f\u4ef6\u7684\u96be\u5ea6\u4ee5\u53ca\u81ea\u52a8\u5206\u6790\u6240\u9700\u8f6f\u4ef6\u5305\u53ca\u5176\u4f9d\u8d56\u5173\u7cfb\u7684\u6280\u672f\u3002\u53ef\u4ee5\u628aYum\u6216DNF\u60f3\u8c61\u6210\u662f\u4e00\u4e2a\u7855\u5927\u7684\u8f6f\u4ef6\u4ed3\u5e93\uff0c\u91cc\u9762\u4fdd\u5b58\u6709\u51e0\u4e4e\u6240\u6709\u5e38\u7528\u7684\u5de5\u5177\uff0c\u800c\u4e14\u53ea\u9700\u8981\u8bf4\u51fa\u6240\u9700\u7684\u8f6f\u4ef6\u5305\u540d\u79f0\uff0c\u7cfb\u7edf\u5c31\u4f1a\u81ea\u52a8\u4e3a\u60a8\u641e\u5b9a\u4e00\u5207\u3002<\/p>\n \u65e2\u7136\u8981\u4f7f\u7528\u8f6f\u4ef6\u4ed3\u5e93\uff0c\u5c31\u8981\u5148\u628a\u5b83\u642d\u5efa\u8d77\u6765\uff0c\u7136\u540e\u5c06\u5176\u914d\u7f6e\u89c4\u5219\u786e\u5b9a\u597d\u624d\u884c\u3002\u9274\u4e8e\u7b2c6\u7ae0\u624d\u4f1a\u8bb2\u89e3Linux\u7684\u5b58\u50a8\u7ed3\u6784\u548c\u8bbe\u5907\u6302\u8f7d\u64cd\u4f5c\uff0c\u6240\u4ee5\u5f53\u524d\u8fd8\u662f\u5c06\u91cd\u5fc3\u653e\u5230Vim\u7f16\u8f91\u5668\u7684\u5b66\u4e60\u4e0a\u3002\u5982\u679c\u9047\u5230\u770b\u4e0d\u61c2\u7684\u53c2\u6570\u4e5f\u4e0d\u8981\u7d27\uff0c\u540e\u9762\u7ae0\u8282\u4f1a\u5355\u72ec\u8bb2\u89e3\u3002<\/p>\n Yum\u4e0eDNF\u8f6f\u4ef6\u4ed3\u5e93\u7684\u914d\u7f6e\u6587\u4ef6\u662f\u901a\u7528\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\u586b\u5199\u597d\u914d\u7f6e\u6587\u4ef6\u4fe1\u606f\u540e\uff0c\u8fd9\u4e24\u4e2a\u8f6f\u4ef6\u4ed3\u5e93\u7684\u547d\u4ee4\u90fd\u662f\u80fd\u591f\u6b63\u5e38\u4f7f\u7528\u3002\u5efa\u8bae\u5728RHEL 10\u4e2d\u4f7f\u7528dnf\u4f5c\u4e3a\u8f6f\u4ef6\u7684\u5b89\u88c5\u547d\u4ee4\uff0c\u56e0\u4e3a\u5b83\u5177\u5907\u66f4\u9ad8\u7684\u6548\u7387\uff0c\u800c\u4e14\u652f\u6301\u591a\u7ebf\u7a0b\u540c\u65f6\u5b89\u88c5\u8f6f\u4ef6\u3002<\/p>\n \u642d\u5efa\u5e76\u914d\u7f6e\u8f6f\u4ef6\u4ed3\u5e93\u7684\u5927\u81f4\u6b65\u9aa4\u5982\u4e0b\u3002<\/p>\n \u3010\u6539\u6539\u6539\uff1a\u68c0\u67e5\u6b65\u9aa4\u3011<\/span>\u7b2c1\u6b65<\/strong>\uff1a\u8fdb\u5165\/etc\/yum.repos.d\/\u76ee\u5f55\u4e2d\uff0c\u8fd9\u91cc\u5b58\u653e\u7740\u6240\u6709\u7684\u4ed3\u5e93\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n \u7b2c2\u6b65<\/strong>\uff1a\u4f7f\u7528Vim\u7f16\u8f91\u5668\u521b\u5efa\u4e00\u4e2a\u540d\u4e3arhel10.repo\u7684\u65b0\u914d\u7f6e\u6587\u4ef6\uff08\u6587\u4ef6\u540d\u79f0\u53ef\u968f\u610f\uff0c\u4f46\u540e\u7f00\u5fc5\u987b\u4e3a.repo\uff09\uff0c\u9010\u9879\u5199\u5165\u4e0b\u9762\u7684\u914d\u7f6e\u53c2\u6570\u5e76\u4fdd\u5b58\u9000\u51fa\u3002<\/p>\n \u4ed3\u5e93\u540d\u79f0<\/strong>\uff1a\u5177\u6709\u552f\u4e00\u6027\u7684\u6807\u8bc6\u540d\u79f0\uff0c\u4e0d\u5e94\u4e0e\u5176\u4ed6\u8f6f\u4ef6\u4ed3\u5e93\u53d1\u751f\u51b2\u7a81\u3002<\/p>\n \u63cf\u8ff0\u4fe1\u606f\uff08name\uff09<\/strong>\uff1a\u4e00\u4e9b\u4ecb\u7ecd\u6027\u7684\u8bcd\uff0c\u6807\u8bc6\u51fa\u8f6f\u4ef6\u4ed3\u5e93\u7684\u7528\u5904\u3002<\/p>\n \u4ed3\u5e93\u4f4d\u7f6e\uff08baseurl\uff09<\/strong>\uff1a\u8f6f\u4ef6\u5305\u7684\u83b7\u53d6\u65b9\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528FTP\u6216HTTP\u4e0b\u8f7d\uff0c\u4e5f\u53ef\u4ee5\u662f\u672c\u5730\u7684\u6587\u4ef6\uff08\u9700\u8981\u5728\u540e\u9762\u6dfb\u52a0file\u53c2\u6570\uff09\u3002<\/p>\n \u662f\u5426\u542f\u7528\uff08enabled\uff09<\/strong>\uff1a\u8bbe\u7f6e\u6b64\u6e90\u662f\u5426\u53ef\u7528\uff1b1\u4e3a\u53ef\u7528\uff0c0\u4e3a\u7981\u7528\u3002<\/p>\n \u662f\u5426\u6821\u9a8c\uff08gpgcheck\uff09<\/strong>\uff1a\u8bbe\u7f6e\u6b64\u6e90\u662f\u5426\u6821\u9a8c\u6587\u4ef6\uff1b1\u4e3a\u6821\u9a8c\uff0c0\u4e3a\u4e0d\u6821\u9a8c\u3002<\/p>\n \u516c\u94a5\u4f4d\u7f6e\uff08gpgkey\uff09<\/strong>\uff1a\u82e5\u4e0a\u9762\u7684\u53c2\u6570\u5f00\u542f\u4e86\u6821\u9a8c\u529f\u80fd\uff0c\u5219\u6b64\u5904\u4e3a\u516c\u94a5\u6587\u4ef6\u4f4d\u7f6e\u3002\u82e5\u6ca1\u6709\u5f00\u542f\uff0c\u5219\u7701\u7565\u4e0d\u5199\u3002<\/p><\/blockquote>\n \u7b2c3\u6b65<\/strong>\uff1a\u6309\u914d\u7f6e\u53c2\u6570\u4e2d\u6240\u586b\u5199\u7684\u4ed3\u5e93\u4f4d\u7f6e\u6302\u8f7d\u5149\u76d8\uff0c\u5e76\u628a\u5149\u76d8\u6302\u8f7d\u4fe1\u606f\u5199\u5165\/etc\/fstab\u6587\u4ef6\u4e2d\u3002<\/p>\n \u7b2c4\u6b65<\/strong>\uff1a\u4f7f\u7528\u201cdnf install httpd -y\u201d\u547d\u4ee4\u68c0\u67e5\u8f6f\u4ef6\u4ed3\u5e93\u662f\u5426\u5df2\u7ecf\u53ef\u7528\u3002<\/p>\n \u5f00\u59cb\u5b9e\u6218\uff01<\/p>\n \u8fdb\u5165\/etc\/yum.repos.d\u76ee\u5f55\u540e\u521b\u5efa\u8f6f\u4ef6\u4ed3\u5e93\u7684\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n \u521b\u5efa\u6302\u8f7d\u70b9\u540e\u8fdb\u884c\u6302\u8f7d\u64cd\u4f5c\uff0c\u5e76\u8bbe\u7f6e\u6210\u5f00\u673a\u81ea\u52a8\u6302\u8f7d\uff08\u8be6\u89c1\u7b2c6\u7ae0\uff09\uff1a<\/p>\n \u5c1d\u8bd5\u4f7f\u7528\u8f6f\u4ef6\u4ed3\u5e93\u7684dnf\u547d\u4ee4\u6765\u5b89\u88c5Web\u670d\u52a1\uff0c\u8f6f\u4ef6\u5305\u540d\u79f0\u4e3ahttpd\uff0c\u5b89\u88c5\u540e\u51fa\u73b0\u201cComplete!<\/strong>\u201d\u5219\u4ee3\u8868\u914d\u7f6e\u6b63\u786e\uff1a<\/p>\n \u5bf9\u4e8e\u4e60\u60ef\u4f7f\u7528yum\u547d\u4ee4\u6765\u5b89\u88c5\u8f6f\u4ef6\u7684\u540c\u5b66\uff0c\u4e5f\u4e0d\u9700\u8981\u6709\u538b\u529b\uff0c\u56e0\u4e3a\u60a8\u4f9d\u7136\u53ef\u4ee5\u4f7f\u7528yum install httpd\u547d\u4ee4\u6765\u5b89\u88c5\u8f6f\u4ef6\uff0c\u53ea\u662f\u5c06dnf\u66ff\u6362\u6210yum\u3002\u53ef\u89c1\uff0cRHEL 10\u7248\u672c\u5f88\u597d\u5730\u517c\u5bb9\u4e86\u7528\u6237\u4e60\u60ef\u3002<\/p>\n \u53ef\u4ee5\u5c06Shell\u7ec8\u7aef\u89e3\u91ca\u5668\u5f53\u4f5c\u4eba\u4e0e\u8ba1\u7b97\u673a\u786c\u4ef6\u4e4b\u95f4\u7684\u201c\u7ffb\u8bd1\u5b98\u201d\uff0c\u5b83\u4f5c\u4e3a\u7528\u6237\u4e0eLinux\u7cfb\u7edf\u5185\u90e8\u7684\u901a\u4fe1\u5a92\u4ecb\uff0c\u9664\u4e86\u80fd\u591f\u652f\u6301\u5404\u79cd\u53d8\u91cf\u4e0e\u53c2\u6570\u5916\uff0c\u8fd8\u63d0\u4f9b\u4e86\u8bf8\u5982\u5faa\u73af\u3001\u5206\u652f\u7b49\u9ad8\u7ea7\u7f16\u7a0b\u8bed\u8a00\u624d\u6709\u7684\u63a7\u5236\u7ed3\u6784\u7279\u6027\u3002\u8981\u60f3\u6b63\u786e\u4f7f\u7528Shell\u4e2d\u7684\u8fd9\u4e9b\u529f\u80fd\u7279\u6027\uff0c\u51c6\u786e\u4e0b\u8fbe\u547d\u4ee4\u5c24\u4e3a\u91cd\u8981\u3002Shell\u811a\u672c\u547d\u4ee4\u7684\u5de5\u4f5c\u65b9\u5f0f\u6709\u4ee5\u4e0b\u4e24\u79cd\uff1a<\/p>\n \u4ea4\u4e92\u5f0f\uff08Interactive\uff09<\/strong>\uff1a\u7528\u6237\u6bcf\u8f93\u5165\u4e00\u6761\u547d\u4ee4\uff0c\u7cfb\u7edf\u5c31\u7acb\u5373\u6267\u884c\u3002<\/p>\n \u6279\u5904\u7406\uff08Batch\uff09<\/strong>\uff1a\u7528\u6237\u4e8b\u5148\u7f16\u5199\u4e00\u4e2a\u5b8c\u6574\u7684Shell\u811a\u672c\uff0cShell\u4f1a\u4e00\u6b21\u6027\u6267\u884c\u811a\u672c\u4e2d\u7684\u6240\u6709\u547d\u4ee4\u3002<\/p><\/blockquote>\n \u5728Shell\u811a\u672c\u4e2d\uff0c\u4e0d\u4ec5\u4f1a\u7528\u5230\u524d\u9762\u5b66\u4e60\u8fc7\u7684\u8bb8\u591aLinux\u547d\u4ee4\uff0c\u8fd8\u4f1a\u6d89\u53ca\u6b63\u5219\u8868\u8fbe\u5f0f\u3001\u7ba1\u9053\u7b26\u3001\u6570\u636e\u6d41\u91cd\u5b9a\u5411\u7b49\u8bed\u6cd5\u89c4\u5219\u3002\u6211\u4eec\u9700\u8981\u5c06\u5185\u90e8\u529f\u80fd\u6a21\u5757\u5316\uff0c\u901a\u8fc7\u903b\u8f91\u8bed\u53e5\u8fdb\u884c\u5904\u7406\uff0c\u6700\u7ec8\u5f62\u6210\u65e5\u5e38\u6240\u89c1\u7684Shell\u811a\u672c\u3002<\/p>\n \u901a\u8fc7\u67e5\u770bSHELL\u53d8\u91cf\uff0c\u53d1\u73b0\u5f53\u524d\u7cfb\u7edf\u5df2\u7ecf\u9ed8\u8ba4\u4f7f\u7528Bash\u4f5c\u4e3a\u547d\u4ee4\u884c\u7ec8\u7aef\u89e3\u91ca\u5668\uff1a<\/p>\n \u4f30\u8ba1\u8bfb\u8005\u5728\u770b\u5b8c\u4e0a\u6587\u4e2d\u6709\u5173Shell\u811a\u672c\u7684\u590d\u6742\u63cf\u8ff0\u540e\uff0c\u4f1a\u7d2f\u89c9\u4e0d\u7231\u5427\u3002\u4f46\u662f\uff0c\u4e0a\u6587\u6307\u7684\u662f\u4e00\u4e2a\u9ad8\u7ea7Shell\u811a\u672c\u7684\u7f16\u5199\u539f\u5219\u3002\u5176\u5b9e\uff0c\u4f7f\u7528Vim\u7f16\u8f91\u5668\u628aLinux\u547d\u4ee4\u6309\u7167\u987a\u5e8f\u4f9d\u6b21\u5199\u5165\u5230\u4e00\u4e2a\u6587\u4ef6\u4e2d\uff0c\u5c31\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u811a\u672c\u4e86\u3002<\/p>\n \u4f8b\u5982\uff0c\u5982\u679c\u60f3\u67e5\u770b\u5f53\u524d\u6240\u5728\u5de5\u4f5c\u8def\u5f84\u5e76\u5217\u51fa\u5f53\u524d\u76ee\u5f55\u4e0b\u6240\u6709\u7684\u6587\u4ef6\u53ca\u5c5e\u6027\u4fe1\u606f\uff0c\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u7684\u811a\u672c\u5e94\u8be5\u7c7b\u4f3c\u4e8e\u4e0b\u9762\u8fd9\u6837\uff1a<\/p>\n Shell\u811a\u672c\u6587\u4ef6\u7684\u540d\u79f0\u53ef\u4ee5\u4efb\u610f\uff0c\u4f46\u4e3a\u4e86\u907f\u514d\u88ab\u8bef\u4ee5\u4e3a\u662f\u666e\u901a\u6587\u4ef6\uff0c\u5efa\u8bae\u5c06.sh\u540e\u7f00\u52a0\u4e0a\uff0c\u4ee5\u8868\u793a\u662f\u4e00\u4e2a\u811a\u672c\u6587\u4ef6\u3002<\/p>\n \u5728\u4e0a\u9762\u7684\u8fd9\u4e2aexample.sh\u811a\u672c\u4e2d\u5b9e\u9645\u4e0a\u51fa\u73b0\u4e86\u4e09\u79cd\u4e0d\u540c\u7684\u5143\u7d20\uff1a\u7b2c\u4e00\u884c\u7684\u811a\u672c\u58f0\u660e\uff08#!\uff09\u7528\u6765\u544a\u8bc9\u7cfb\u7edf\u4f7f\u7528\u54ea\u79cdShell\u89e3\u91ca\u5668\u6765\u6267\u884c\u8be5\u811a\u672c\uff1b\u7b2c\u4e8c\u884c\u7684\u6ce8\u91ca\u4fe1\u606f\uff08#\uff09\u662f\u5bf9\u811a\u672c\u529f\u80fd\u548c\u67d0\u4e9b\u547d\u4ee4\u7684\u4ecb\u7ecd\u4fe1\u606f\uff0c\u4f7f\u5f97\u81ea\u5df1\u6216\u4ed6\u4eba\u5728\u65e5\u540e\u770b\u5230\u8fd9\u4e2a\u811a\u672c\u5185\u5bb9\u65f6\uff0c\u53ef\u4ee5\u5feb\u901f\u77e5\u9053\u8be5\u811a\u672c\u7684\u4f5c\u7528\u6216\u4e00\u4e9b\u8b66\u544a\u4fe1\u606f\uff1b\u7b2c\u4e09\u3001\u56db\u884c\u7684\u53ef\u6267\u884c\u8bed\u53e5\u4e5f\u5c31\u662f\u6211\u4eec\u5e73\u65f6\u6267\u884c\u7684Linux\u547d\u4ee4\u3002\u4f60\u4eec\u4e0d\u76f8\u4fe1\u8fd9\u4e48\u7b80\u5355\u5c31\u7f16\u5199\u51fa\u6765\u4e86\u4e00\u4e2a\u811a\u672c\u7a0b\u5e8f\uff1f\uff01\u6765\u6267\u884c\u4e00\u4e0b\u770b\u770b\u7ed3\u679c\uff1a<\/p>\n \u9664\u4e86\u4e0a\u9762\u7528Bash\u89e3\u91ca\u5668\u547d\u4ee4\u76f4\u63a5\u8fd0\u884cShell\u811a\u672c\u6587\u4ef6\u5916\uff0c\u7b2c\u4e8c\u79cd\u8fd0\u884c\u811a\u672c\u7a0b\u5e8f\u7684\u65b9\u6cd5\u662f\u901a\u8fc7\u8f93\u5165\u5b8c\u6574\u8def\u5f84\u7684\u65b9\u5f0f\u6765\u6267\u884c\u3002\u4f46\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u56e0\u4e3a\u6743\u9650\u4e0d\u8db3\u800c\u63d0\u793a\u62a5\u9519\u4fe1\u606f\uff0c\u6b64\u65f6\u53ea\u9700\u8981\u4e3a\u811a\u672c\u6587\u4ef6\u589e\u52a0\u6267\u884c\u6743\u9650\u5373\u53ef\uff08\u8be6\u89c1\u7b2c5\u7ae0\uff09\u3002\u521d\u6b21\u5b66\u4e60Linux\u7cfb\u7edf\u7684\u8bfb\u8005\u4e0d\u7528\u5fc3\u6025\uff0c\u7b49\u4e0b\u4e00\u7ae0\u5b66\u5b8c\u7528\u6237\u8eab\u4efd\u548c\u6743\u9650\u540e\u518d\u6765\u505a\u8fd9\u4e2a\u5b9e\u9a8c\u4e5f\u4e0d\u8fdf\uff1a<\/p>\n \u4f46\u662f\uff0c\u50cf\u4e0a\u9762\u8fd9\u6837\u7684\u811a\u672c\u7a0b\u5e8f\u53ea\u80fd\u6267\u884c\u4e00\u4e9b\u9884\u5148\u5b9a\u4e49\u597d\u7684\u529f\u80fd\uff0c\u672a\u514d\u592a\u8fc7\u6b7b\u677f\u3002\u4e3a\u4e86\u8ba9Shell\u811a\u672c\u7a0b\u5e8f\u66f4\u597d\u5730\u6ee1\u8db3\u7528\u6237\u7684\u4e00\u4e9b\u5b9e\u65f6\u9700\u6c42\uff0c\u4ee5\u4fbf\u7075\u6d3b\u5b8c\u6210\u5de5\u4f5c\uff0c\u5fc5\u987b\u8981\u8ba9\u811a\u672c\u7a0b\u5e8f\u80fd\u591f\u50cf\u4e4b\u524d\u6267\u884c\u547d\u4ee4\u65f6\u90a3\u6837\uff0c\u63a5\u6536\u7528\u6237\u8f93\u5165\u7684\u53c2\u6570\u3002<\/p>\n \u4f8b\u5982\uff0c\u5f53\u7528\u6237\u6267\u884c\u67d0\u4e00\u4e2a\u547d\u4ee4\u65f6\uff0c\u52a0\u6216\u4e0d\u52a0\u53c2\u6570\u7684\u8f93\u51fa\u7ed3\u679c\u662f\u4e0d\u540c\u7684<\/p>\n \u8fd9\u610f\u5473\u7740\u547d\u4ee4\u4e0d\u4ec5\u8981\u80fd\u63a5\u6536\u7528\u6237\u8f93\u5165\u7684\u5185\u5bb9\uff0c\u8fd8\u8981\u6709\u80fd\u529b\u8fdb\u884c\u5224\u65ad\u533a\u522b\uff0c\u6839\u636e\u4e0d\u540c\u7684\u8f93\u5165\u8c03\u7528\u4e0d\u540c\u7684\u529f\u80fd\u3002<\/p>\n \u5176\u5b9e\uff0cLinux\u7cfb\u7edf\u4e2d\u7684Shell\u811a\u672c\u8bed\u8a00\u65e9\u5c31\u8003\u8651\u5230\u4e86\u8fd9\u4e9b\uff0c\u5df2\u7ecf\u5185\u8bbe\u4e86\u7528\u4e8e\u63a5\u6536\u53c2\u6570\u7684\u53d8\u91cf\uff0c\u53d8\u91cf\u4e4b\u95f4\u4f7f\u7528\u7a7a\u683c\u95f4\u9694\u3002\u4f8b\u5982\uff0c$0\u5bf9\u5e94\u7684\u662f\u5f53\u524dShell\u811a\u672c\u7a0b\u5e8f\u7684\u540d\u79f0\uff0c$#\u5bf9\u5e94\u7684\u662f\u603b\u5171\u6709\u51e0\u4e2a\u53c2\u6570\uff0c$*\u5bf9\u5e94\u7684\u662f\u6240\u6709\u4f4d\u7f6e\u7684\u53c2\u6570\u503c\uff0c$?\u5bf9\u5e94\u7684\u662f\u663e\u793a\u4e0a\u4e00\u6b21\u547d\u4ee4\u7684\u6267\u884c\u8fd4\u56de\u503c\uff0c\u800c$1\u3001$2\u3001$3\u2026\u2026\u5219\u5206\u522b\u5bf9\u5e94\u7740\u7b2cN<\/em>\u4e2a\u4f4d\u7f6e\u7684\u53c2\u6570\u503c\uff0c\u5982\u56fe4-15\u6240\u793a\u3002<\/p>\n <\/p>\n \u56fe4-15\u00a0 Shell\u811a\u672c\u7a0b\u5e8f\u4e2d\u7684\u53c2\u6570\u4f4d\u7f6e\u53d8\u91cf<\/p>\n \u7406\u8bba\u8fc7\u540e\u518d\u6765\u7ec3\u4e60\u4e00\u4e0b\u3002\u5c1d\u8bd5\u7f16\u5199\u4e00\u4e2a\u811a\u672c\u7a0b\u5e8f\u793a\u4f8b\uff0c\u901a\u8fc7\u5f15\u7528\u4e0a\u9762\u7684\u53d8\u91cf\u53c2\u6570\u6765\u770b\u4e00\u4e0b\u771f\u5b9e\u6548\u679c\uff1a<\/p>\n \u5b66\u4e60\u662f\u4e00\u4e2a\u767b\u5802\u5165\u5ba4\u3001\u7531\u6d45\u5165\u6df1\u7684\u8fc7\u7a0b\u3002\u5728\u5b66\u4e60\u5b8cLinux\u547d\u4ee4\uff0c\u638c\u63e1Shell\u811a\u672c\u8bed\u6cd5\u53d8\u91cf\u548c\u63a5\u6536\u7528\u6237\u8f93\u5165\u7684\u4fe1\u606f\u4e4b\u540e\uff0c\u5c31\u8981\u8e0f\u4e0a\u65b0\u7684\u9ad8\u5ea6\u2014\u2014\u80fd\u591f\u8fdb\u4e00\u6b65\u5904\u7406\u63a5\u6536\u5230\u7684\u7528\u6237\u53c2\u6570\u3002<\/p>\n \u672c\u4e66\u5728\u524d\u9762\u7ae0\u8282\u4e2d\u8bb2\u5230\uff0c\u7cfb\u7edf\u5728\u6267\u884cmkdir\u547d\u4ee4\u65f6\u4f1a\u5224\u65ad\u7528\u6237\u8f93\u5165\u7684\u4fe1\u606f\uff0c\u5373\u5224\u65ad\u7528\u6237\u6307\u5b9a\u7684\u6587\u4ef6\u5939\u540d\u79f0\u662f\u5426\u5df2\u7ecf\u5b58\u5728\uff0c\u5982\u679c\u5b58\u5728\u5219\u63d0\u793a\u62a5\u9519\uff1b\u53cd\u4e4b\u5219\u81ea\u52a8\u521b\u5efa\u3002Shell\u811a\u672c\u4e2d\u7684\u6761\u4ef6\u6d4b\u8bd5\u8bed\u6cd5\u53ef\u4ee5\u5224\u65ad\u8868\u8fbe\u5f0f\u662f\u5426\u6210\u7acb\uff0c\u82e5\u6761\u4ef6\u6210\u7acb\u5219\u8fd4\u56de\u6570\u5b570\uff0c\u5426\u5219\u4fbf\u8fd4\u56de\u975e\u96f6\u503c\u3002\u6761\u4ef6\u6d4b\u8bd5\u8bed\u6cd5\u7684\u6267\u884c\u683c\u5f0f\u5982\u56fe4-16\u6240\u793a\u3002\u5207\u8bb0\uff0c\u6761\u4ef6\u8868\u8fbe\u5f0f\u4e24\u8fb9\u5747\u5e94\u6709\u4e00\u4e2a\u7a7a\u683c\u3002<\/p>\n <\/p>\n \u56fe4-16\u00a0 \u6761\u4ef6\u6d4b\u8bd5\u8bed\u53e5\u7684\u6267\u884c\u683c\u5f0f<\/p>\n \u6309\u7167\u6d4b\u8bd5\u5bf9\u8c61\u6765\u5212\u5206\uff0c\u6761\u4ef6\u6d4b\u8bd5\u8bed\u53e5\u5e38\u88ab\u5206\u4e3a\u56db\u79cd\u7c7b\u578b\uff1a<\/p>\n \u6587\u4ef6\u6d4b\u8bd5\u8bed\u53e5\uff1b<\/p>\n \u903b\u8f91\u6d4b\u8bd5\u8bed\u53e5\uff1b<\/p>\n \u6574\u6570\u503c\u6bd4\u8f83\u8bed\u53e5\uff1b<\/p>\n \u5b57\u7b26\u4e32\u6bd4\u8f83\u8bed\u53e5\u3002<\/p><\/blockquote>\n \u6587\u4ef6\u6d4b\u8bd5\u5373\u4f7f\u7528\u6307\u5b9a\u6761\u4ef6\u6765\u5224\u65ad\u6587\u4ef6\u662f\u5426\u5b58\u5728\u6216\u6743\u9650\u662f\u5426\u6ee1\u8db3\u7b49\u60c5\u51b5\u7684\u8fd0\u7b97\u7b26\uff0c\u5177\u4f53\u7684\u53c2\u6570\u5982\u88684-3\u6240\u793a\u3002<\/p>\n \u88684-3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u6587\u4ef6\u6d4b\u8bd5\u6240\u7528\u7684\u53c2\u6570<\/p>\n <\/p>\n \u4e0b\u9762\u4f7f\u7528\u6587\u4ef6\u6d4b\u8bd5\u8bed\u53e5\u6765\u5224\u65ad\/etc\/fstab\u662f\u5426\u4e3a\u4e00\u4e2a\u76ee\u5f55\u7c7b\u578b\u7684\u6587\u4ef6\uff0c\u7136\u540e\u901a\u8fc7Shell\u89e3\u91ca\u5668\u7684\u5185\u8bbe$?\u53d8\u91cf\u663e\u793a\u4e0a\u4e00\u6761\u547d\u4ee4\u6267\u884c\u540e\u7684\u8fd4\u56de\u503c\u3002\u5982\u679c\u8fd4\u56de\u503c\u4e3a0\uff0c\u5219\u76ee\u5f55\u5b58\u5728\uff1b\u5982\u679c\u8fd4\u56de\u503c\u4e3a\u975e\u96f6\u503c\uff0c\u5219\u610f\u5473\u7740\u5b83\u4e0d\u662f\u76ee\u5f55\uff0c\u6216\u8fd9\u4e2a\u76ee\u5f55\u4e0d\u5b58\u5728\uff1a<\/p>\n \u518d\u4f7f\u7528\u6587\u4ef6\u6d4b\u8bd5\u8bed\u53e5\u6765\u5224\u65ad\/etc\/fstab\u662f\u5426\u4e3a\u4e00\u822c\u6587\u4ef6\uff0c\u5982\u679c\u8fd4\u56de\u503c\u4e3a0\uff0c\u5219\u4ee3\u8868\u6587\u4ef6\u5b58\u5728\uff0c\u4e14\u4e3a\u4e00\u822c\u6587\u4ef6\uff1a<\/p>\n \u5224\u65ad\u4e0e\u67e5\u8be2\u4e00\u5b9a\u8981\u6572\u4e24\u6b21\u547d\u4ee4\u5417\uff1f\u5176\u5b9e\u4e5f\u80fd\u4e00\u6b21\u6027\u641e\u5b9a\u3002<\/p>\n \u903b\u8f91\u8bed\u53e5\u7528\u4e8e\u5bf9\u6d4b\u8bd5\u7ed3\u679c\u8fdb\u884c\u903b\u8f91\u5206\u6790\uff0c\u6839\u636e\u6d4b\u8bd5\u7ed3\u679c\u53ef\u5b9e\u73b0\u4e0d\u540c\u7684\u6548\u679c\u3002\u4f8b\u5982\u5728Shell\u7ec8\u7aef\u4e2d\u903b\u8f91\u201c\u4e0e\u201d\u7684\u8fd0\u7b97\u7b26\u53f7\u662f&&\uff0c\u5b83\u8868\u793a\u5f53\u524d\u9762\u7684\u547d\u4ee4\u6267\u884c\u6210\u529f\u540e\u624d\u4f1a\u6267\u884c\u5b83\u540e\u9762\u7684\u547d\u4ee4\uff0c\u56e0\u6b64\u53ef\u4ee5\u7528\u6765\u5224\u65ad\/dev\/cdrom\u6587\u4ef6\u662f\u5426\u5b58\u5728\uff0c\u82e5\u5b58\u5728\u5219\u8f93\u51faExist\u5b57\u6837\u3002<\/p>\n \u9664\u4e86\u903b\u8f91\u201c\u4e0e\u201d\u5916\uff0c\u8fd8\u6709\u903b\u8f91\u201c\u6216\u201d\uff0c\u5b83\u5728Linux\u7cfb\u7edf\u4e2d\u7684\u8fd0\u7b97\u7b26\u53f7\u4e3a||\uff0c\u8868\u793a\u5f53\u524d\u9762\u7684\u547d\u4ee4\u6267\u884c\u5931\u8d25\u540e\u624d\u4f1a\u6267\u884c\u5b83\u540e\u9762\u7684\u547d\u4ee4\uff0c\u56e0\u6b64\u53ef\u4ee5\u7528\u7cfb\u7edf\u73af\u5883\u53d8\u91cfUSER\u6765\u5224\u65ad\u5f53\u524d\u767b\u5f55\u7684\u7528\u6237\u662f\u5426\u4e3a\u975e\u7ba1\u7406\u5458\u8eab\u4efd\uff1a<\/p>\n \u7b2c\u4e09\u79cd\u903b\u8f91\u8bed\u53e5\u662f\u201c\u975e\u201d\uff0c\u5728Linux\u7cfb\u7edf\u4e2d\u7684\u8fd0\u7b97\u7b26\u53f7\u662f\u4e00\u4e2a\u53f9\u53f7\uff08!\uff09\uff0c\u5b83\u8868\u793a\u628a\u6761\u4ef6\u6d4b\u8bd5\u4e2d\u7684\u5224\u65ad\u7ed3\u679c\u53d6\u76f8\u53cd\u503c\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u539f\u672c\u6d4b\u8bd5\u7684\u7ed3\u679c\u662f\u6b63\u786e\u7684\uff0c\u5219\u5c06\u5176\u53d8\u6210\u9519\u8bef\u7684\uff1b\u539f\u672c\u6d4b\u8bd5\u9519\u8bef\u7684\u7ed3\u679c\uff0c\u5219\u5c06\u5176\u53d8\u6210\u6b63\u786e\u7684\u3002<\/p>\n \u6211\u4eec\u73b0\u5728\u5207\u6362\u56de\u5230root\u7ba1\u7406\u5458\u8eab\u4efd\uff0c\u518d\u5224\u65ad\u5f53\u524d\u7528\u6237\u662f\u5426\u4e3a\u4e00\u4e2a\u975e\u7ba1\u7406\u5458\u7684\u7528\u6237\u3002\u7531\u4e8e\u5224\u65ad\u7ed3\u679c\u56e0\u4e3a\u4e24\u6b21\u5426\u5b9a\u800c\u53d8\u6210\u6b63\u786e\uff0c\u56e0\u6b64\u4f1a\u6b63\u5e38\u5730\u8f93\u51fa\u9884\u8bbe\u4fe1\u606f\uff1a<\/p>\n \u53f9\u53f7\u5e94\u8be5\u653e\u5230\u5224\u65ad\u8bed\u53e5\u7684\u524d\u9762\uff0c\u4ee3\u8868\u5bf9\u6574\u4e2a\u7684\u6d4b\u8bd5\u8bed\u53e5\u8fdb\u884c\u53d6\u53cd\u503c\u64cd\u4f5c\uff0c\u800c\u4e0d\u5e94\u8be5\u5199\u6210\u201c$USER != root\u201d\uff0c\u56e0\u4e3a\u201c!=\u201d\u4ee3\u8868\u7684\u662f\u4e0d\u7b49\u4e8e\u7b26\u53f7\uff08\u2260\uff09\uff0c\u5c3d\u7ba1\u6267\u884c\u6548\u679c\u4e00\u6837\uff0c\u4f46\u7f3a\u5c11\u4e86\u903b\u8f91\u5173\u7cfb\uff0c\u8fd9\u4e00\u70b9\u8fd8\u8bf7\u591a\u52a0\u6ce8\u610f\u3002<\/p>\n &&\u662f\u903b\u8f91\u201c\u4e0e\u201d\uff0c\u53ea\u6709\u5f53\u524d\u9762\u7684\u8bed\u53e5\u6267\u884c\u6210\u529f\u7684\u65f6\u5019\u624d\u4f1a\u6267\u884c\u540e\u9762\u7684\u8bed\u53e5\u3002<\/p>\n ||\u662f\u903b\u8f91\u201c\u6216\u201d\uff0c\u53ea\u6709\u5f53\u524d\u9762\u7684\u8bed\u53e5\u6267\u884c\u5931\u8d25\u7684\u65f6\u5019\u624d\u4f1a\u6267\u884c\u540e\u9762\u7684\u8bed\u53e5\u3002<\/p>\n !\u662f\u903b\u8f91\u201c\u975e\u201d\uff0c\u4ee3\u8868\u5bf9\u903b\u8f91\u6d4b\u8bd5\u7ed3\u679c\u53d6\u53cd\u503c\uff1b\u4e4b\u524d\u82e5\u4e3a\u6b63\u786e\u5219\u53d8\u6210\u9519\u8bef\uff0c\u82e5\u4e3a\u9519\u8bef\u5219\u53d8\u6210\u6b63\u786e\u3002<\/p>\n<\/div>\n<\/div>\n \u5c31\u6280\u672f\u56fe\u4e66\u7684\u5199\u4f5c\u6765\u8bb2\uff0c\u4e00\u822c\u6709\u4e24\u79cd\u5957\u8def\uff1a\u8ba9\u8bfb\u8005\u771f\u6b63\u641e\u61c2\u6280\u672f\u4e86\uff1b\u8ba9\u8bfb\u8005\u89c9\u5f97\u81ea\u5df1\u641e\u61c2\u6280\u672f\u4e86\u3002\u56e0\u6b64\u5e02\u9762\u4e0a\u5f88\u591a\u6d45\u663e\u7684\u56fe\u4e66\u4f1a\u8ba9\u8bfb\u8005\u5728\u5b66\u5b8c\u4e4b\u540e\u611f\u89c9\u8fdb\u6b65\u7279\u522b\u5feb\uff0c\u8fd9\u57fa\u672c\u4e0a\u662f\u4f5c\u8005\u6709\u610f\u4e3a\u4e4b\uff0c\u76ee\u7684\u5c31\u662f\u8ba9\u60a8\u89c9\u5f97\u201c\u56fe\u4e66\u5f88\u6709\u6599\uff0c\u81ea\u5df1\u6536\u83b7\u5f88\u5927\u201d\uff0c\u4f46\u662f\u5728\u6b65\u5165\u5de5\u4f5c\u5c97\u4f4d\u540e\u5c31\u9732\u51fa\u77ed\u677f\u5403\u5927\u4e8f\u3002\u6240\u4ee5\u5218\u9044\u8001\u5e08\u51b3\u5b9a\u7ee7\u7eed\u63d0\u9ad8\u96be\u5ea6\uff0c\u4e3a\u8bfb\u8005\u589e\u52a0\u4e00\u4e2a\u7efc\u5408\u7684\u793a\u4f8b\uff0c\u4e00\u65b9\u9762\u4f5c\u4e3a\u524d\u8ff0\u77e5\u8bc6\u7684\u603b\u7ed3\uff0c\u53e6\u4e00\u65b9\u9762\u5e2e\u52a9\u8bfb\u8005\u592f\u5b9e\u57fa\u7840\uff0c\u4ee5\u4fbf\u5728\u4eca\u540e\u7684\u5de5\u4f5c\u4e2d\u66f4\u7075\u6d3b\u5730\u4f7f\u7528\u903b\u8f91\u7b26\u53f7\u3002<\/p>\n \u5f53\u524d\u6211\u4eec\u6b63\u5728\u767b\u5f55\u7684\u5373\u4e3a\u7ba1\u7406\u5458\u7528\u6237\u2014\u2014root\u3002\u4e0b\u9762\u8fd9\u4e2a\u793a\u4f8b\u7684\u6267\u884c\u987a\u5e8f\u662f\uff0c\u5148\u5224\u65ad\u5f53\u524d\u767b\u5f55\u7528\u6237\u7684USER\u53d8\u91cf\u540d\u79f0\u662f\u5426\u7b49\u4e8eroot\uff0c\u7136\u540e\u7528\u903b\u8f91\u201c\u975e\u201d\u8fd0\u7b97\u7b26\u8fdb\u884c\u53d6\u53cd\u64cd\u4f5c\uff0c\u6548\u679c\u5c31\u53d8\u6210\u4e86\u5224\u65ad\u5f53\u524d\u767b\u5f55\u7684\u7528\u6237\u662f\u5426\u4e3a\u975e\u7ba1\u7406\u5458\u7528\u6237\u3002\u6700\u540e\u82e5\u6761\u4ef6\u6210\u7acb\uff0c\u5219\u4f1a\u6839\u636e\u903b\u8f91\u201c\u4e0e\u201d\u8fd0\u7b97\u7b26\u8f93\u51fauser\u5b57\u6837\uff1b\u82e5\u6761\u4ef6\u4e0d\u6ee1\u8db3\uff0c\u5219\u4f1a\u901a\u8fc7\u903b\u8f91\u201c\u6216\u201d\u8fd0\u7b97\u7b26\u8f93\u51faroot\u5b57\u6837\uff0c\u800c\u53ea\u6709\u5728\u524d\u9762\u7684&&\u4e0d\u6210\u7acb\u65f6\u624d\u4f1a\u6267\u884c\u540e\u9762\u7684||\u7b26\u53f7\u3002<\/p>\n \u6574\u6570\u6bd4\u8f83\u8fd0\u7b97\u7b26\u4ec5\u662f\u5bf9\u6570\u5b57\u7684\u64cd\u4f5c\uff0c\u4e0d\u80fd\u5c06\u6570\u5b57\u4e0e\u5b57\u7b26\u4e32\u3001\u6587\u4ef6\u7b49\u5185\u5bb9\u4e00\u8d77\u64cd\u4f5c\uff0c\u800c\u4e14\u4e0d\u80fd\u60f3\u5f53\u7136\u5730\u4f7f\u7528\u65e5\u5e38\u751f\u6d3b\u4e2d\u7684\u7b49\u53f7\u3001\u5927\u4e8e\u53f7\u3001\u5c0f\u4e8e\u53f7\u7b49\u6765\u5224\u65ad\u3002\u56e0\u4e3a\u7b49\u53f7\u4e0e\u8d4b\u503c\u547d\u4ee4\u7b26\u51b2\u7a81\uff0c\u5927\u4e8e\u53f7\u548c\u5c0f\u4e8e\u53f7\u5206\u522b\u4e0e\u8f93\u51fa\u91cd\u5b9a\u5411\u547d\u4ee4\u7b26\u548c\u8f93\u5165\u91cd\u5b9a\u5411\u547d\u4ee4\u7b26\u51b2\u7a81\u3002\u56e0\u6b64\u4e00\u5b9a\u8981\u4f7f\u7528\u89c4\u8303\u7684\u6574\u6570\u6bd4\u8f83\u8fd0\u7b97\u7b26\u6765\u8fdb\u884c\u64cd\u4f5c\u3002\u53ef\u7528\u7684\u6574\u6570\u6bd4\u8f83\u8fd0\u7b97\u7b26\u5982\u88684-4\u6240\u793a\u3002<\/p>\n \u88684-4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u53ef\u7528\u7684\u6574\u6570\u6bd4\u8f83\u8fd0\u7b97\u7b26<\/p>\n <\/p>\n \u63a5\u4e0b\u6765\u5c0f\u8bd5\u725b\u5200\u3002\u5148\u6d4b\u8bd5\u4e00\u4e0b10\u662f\u5426\u5927\u4e8e10\u4ee5\u53ca10\u662f\u5426\u7b49\u4e8e10\uff08\u901a\u8fc7\u8f93\u51fa\u7684\u8fd4\u56de\u503c\u5185\u5bb9\u6765\u5224\u65ad\uff09\uff1a<\/p>\n \u57282.4\u8282\u66fe\u7ecf\u8bb2\u8fc7free\u547d\u4ee4\uff0c\u5b83\u80fd\u591f\u7528\u6765\u83b7\u53d6\u5f53\u524d\u7cfb\u7edf\u6b63\u5728\u4f7f\u7528\u53ca\u53ef\u7528\u7684\u5185\u5b58\u91cf\u4fe1\u606f\u3002\u63a5\u4e0b\u6765\u5148\u4f7f\u7528free -m\u547d\u4ee4\u67e5\u770b\u5185\u5b58\u4f7f\u7528\u91cf\u60c5\u51b5\uff08\u5355\u4f4d\u4e3aMB\uff09\uff0c\u7136\u540e\u901a\u8fc7\u201cgrep Mem:\u201d\u547d\u4ee4\u8fc7\u6ee4\u51fa\u5269\u4f59\u5185\u5b58\u91cf\u7684\u884c\uff0c\u518d\u7528awk '{print $4}'\u547d\u4ee4\u53ea\u4fdd\u7559\u7b2c4\u5217\u3002\u8fd9\u4e2a\u6f14\u793a\u786e\u5b9e\u6709\u4e9b\u96be\u5ea6\uff0c\u4f46\u770b\u61c2\u540e\u4f1a\u89c9\u5f97\u5f88\u6709\u610f\u601d\uff0c\u6ca1\u51c6\u5728\u8fd0\u7ef4\u5de5\u4f5c\u4e2d\u4e5f\u4f1a\u7528\u5f97\u4e0a\u3002<\/p>\n \u5982\u679c\u60f3\u628a\u8fd9\u4e2a\u547d\u4ee4\u5199\u5165\u5230Shell\u811a\u672c\u4e2d\uff0c\u90a3\u4e48\u5efa\u8bae\u628a\u8f93\u51fa\u7ed3\u679c\u8d4b\u503c\u7ed9\u4e00\u4e2a\u53d8\u91cf\uff0c\u4ee5\u65b9\u4fbf\u5176\u4ed6\u547d\u4ee4\u8fdb\u884c\u8c03\u7528\uff1a<\/p>\n \u4e0a\u9762\u7528\u4e8e\u83b7\u53d6\u5185\u5b58\u53ef\u7528\u91cf\u7684\u547d\u4ee4\u4ee5\u53ca\u6b65\u9aa4\u53ef\u80fd\u6709\u4e9b\u201c\u8d85\u7eb2\u201d\u4e86\uff0c\u5982\u679c\u4e0d\u80fd\u7406\u89e3\u9886\u4f1a\u4e5f\u4e0d\u7528\u62c5\u5fc3\uff0c\u63a5\u4e0b\u6765\u624d\u662f\u91cd\u70b9\u3002\u4f7f\u7528\u6574\u6570\u8fd0\u7b97\u7b26\u6765\u5224\u65ad\u5185\u5b58\u53ef\u7528\u91cf\u7684\u503c\u662f\u5426\u5c0f\u4e8e1024\uff0c\u82e5\u5c0f\u4e8e\u5219\u4f1a\u63d0\u793a\u201cInsufficient Memory\u201d\uff08\u5185\u5b58\u4e0d\u8db3\uff09\u7684\u5b57\u6837\uff1a<\/p>\n \u5b57\u7b26\u4e32\u6bd4\u8f83\u8bed\u53e5\u7528\u4e8e\u5224\u65ad\u6d4b\u8bd5\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u503c\uff0c\u6216\u4e24\u4e2a\u5b57\u7b26\u4e32\u662f\u5426\u76f8\u540c\u3002\u5b83\u7ecf\u5e38\u7528\u6765\u5224\u65ad\u67d0\u4e2a\u53d8\u91cf\u662f\u5426\u672a\u88ab\u5b9a\u4e49\uff08\u5373\u5185\u5bb9\u4e3a\u7a7a\u503c\uff09\uff0c\u7406\u89e3\u8d77\u6765\u4e5f\u6bd4\u8f83\u7b80\u5355\u3002\u5b57\u7b26\u4e32\u6bd4\u8f83\u4e2d\u5e38\u89c1\u7684\u8fd0\u7b97\u7b26\u5982\u88684-5\u6240\u793a\u3002<\/p>\n \u88684-5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u5e38\u89c1\u7684\u5b57\u7b26\u4e32\u6bd4\u8f83\u8fd0\u7b97\u7b26<\/p>\n <\/p>\n \u63a5\u4e0b\u6765\u901a\u8fc7\u5224\u65adString\u53d8\u91cf\u662f\u5426\u4e3a\u7a7a\u503c\uff0c\u8fdb\u800c\u5224\u65ad\u662f\u5426\u5b9a\u4e49\u4e86\u8fd9\u4e2a\u53d8\u91cf\uff1a<\/p>\n \u518d\u6b21\u5c1d\u8bd5\u5f15\u5165\u903b\u8f91\u8fd0\u7b97\u7b26\u6765\u8bd5\u4e00\u4e0b\u3002\u5f53\u7528\u4e8e\u4fdd\u5b58\u5f53\u524d\u8bed\u7cfb\u7684\u73af\u5883\u53d8\u91cf\u503cLANG\u4e0d\u662f\u82f1\u8bed\uff08en.US\uff09\u65f6\uff0c\u5219\u4f1a\u6ee1\u8db3\u903b\u8f91\u6d4b\u8bd5\u6761\u4ef6\u5e76\u8f93\u51fa\u201cNot en.US\u201d\uff08\u975e\u82f1\u8bed\uff09\u7684\u5b57\u6837\uff1a<\/p>\n4.1 Vim\u6587\u672c\u7f16\u8f91\u5668<\/strong><\/span><\/h5>\n
\n<\/span><\/p>\n\n\n
\n \u547d\u4ee4<\/td>\n \u4f5c\u7528<\/td>\n<\/tr>\n \n dd<\/td>\n \u5220\u9664\uff08\u526a\u5207\uff09\u5149\u6807\u6240\u5728\u6574\u884c<\/td>\n<\/tr>\n \n 5dd<\/td>\n \u5220\u9664\uff08\u526a\u5207\uff09\u4ece\u5149\u6807\u5904\u5f00\u59cb\u76845\u884c<\/td>\n<\/tr>\n \n yy<\/td>\n \u590d\u5236\u5149\u6807\u6240\u5728\u6574\u884c<\/td>\n<\/tr>\n \n 5yy<\/td>\n \u590d\u5236\u4ece\u5149\u6807\u5904\u5f00\u59cb\u76845\u884c<\/td>\n<\/tr>\n \n n<\/td>\n \u663e\u793a\u641c\u7d22\u547d\u4ee4\u5b9a\u4f4d\u5230\u7684\u4e0b\u4e00\u4e2a\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n \n N<\/td>\n \u663e\u793a\u641c\u7d22\u547d\u4ee4\u5b9a\u4f4d\u5230\u7684\u4e0a\u4e00\u4e2a\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n \n u<\/td>\n \u64a4\u9500\u4e0a\u4e00\u6b65\u7684\u64cd\u4f5c<\/td>\n<\/tr>\n \n p<\/td>\n \u5c06\u4e4b\u524d\u5220\u9664\uff08dd\uff09\u6216\u590d\u5236\uff08yy\uff09\u8fc7\u7684\u6570\u636e\u7c98\u8d34\u5230\u5149\u6807\u540e\u9762<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \n\n
\n \u547d\u4ee4<\/td>\n \u4f5c\u7528<\/td>\n<\/tr>\n \n :w<\/td>\n \u4fdd\u5b58<\/td>\n<\/tr>\n \n :q<\/td>\n \u9000\u51fa<\/td>\n<\/tr>\n \n :q!<\/td>\n \u5f3a\u5236\u9000\u51fa\uff08\u653e\u5f03\u5bf9\u6587\u6863\u7684\u4fee\u6539\u5185\u5bb9\uff09<\/td>\n<\/tr>\n \n :wq!<\/td>\n \u5f3a\u5236\u4fdd\u5b58\u9000\u51fa<\/td>\n<\/tr>\n \n :set nu<\/td>\n \u663e\u793a\u884c\u53f7<\/td>\n<\/tr>\n \n :set nonu<\/td>\n \u4e0d\u663e\u793a\u884c\u53f7<\/td>\n<\/tr>\n \n :\u547d\u4ee4<\/td>\n \u6267\u884c\u8be5\u547d\u4ee4<\/td>\n<\/tr>\n \n :\u6574\u6570<\/td>\n \u8df3\u8f6c\u5230\u8be5\u884c<\/td>\n<\/tr>\n \n :s\/one\/two<\/td>\n \u5c06\u5f53\u524d\u5149\u6807\u6240\u5728\u884c\u7684\u7b2c\u4e00\u4e2aone\u66ff\u6362\u6210two<\/td>\n<\/tr>\n \n :s\/one\/two\/g<\/td>\n \u5c06\u5f53\u524d\u5149\u6807\u6240\u5728\u884c\u7684\u6240\u6709one\u66ff\u6362\u6210two<\/td>\n<\/tr>\n \n :%s\/one\/two\/g<\/td>\n \u5c06\u5168\u6587\u4e2d\u7684\u6240\u6709one\u66ff\u6362\u6210two<\/td>\n<\/tr>\n \n ?\u5b57\u7b26\u4e32<\/td>\n \u5728\u6587\u672c\u4e2d\u4ece\u4e0b\u81f3\u4e0a\u641c\u7d22\u8be5\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n \n \/\u5b57\u7b26\u4e32<\/td>\n \u5728\u6587\u672c\u4e2d\u4ece\u4e0a\u81f3\u4e0b\u641c\u7d22\u8be5\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n 4.1.1 \u7f16\u5199\u7b80\u5355\u6587\u6863<\/strong><\/span><\/h6>\n
Tips<\/strong><\/h3>\n<\/div>\n
Tips<\/strong><\/h3>\n<\/div>\n
4.1.2 \u914d\u7f6e\u4e3b\u673a\u540d\u79f0<\/span><\/strong><\/h6>\n
[root@linuxprobe ~]# vim \/etc\/hostname\r\nlrxjmw.cn\r\n<\/pre>\n
[root@linuxprobe ~]# hostname\r\nlrxjmw.cn\r\n<\/pre>\n
4.1.3 \u914d\u7f6e\u7f51\u5361\u4fe1\u606f<\/strong><\/span><\/h6>\n
\u3010\u6539\u6539\u6539\u3011<\/span><\/strong>[root@linuxprobe ~]# cd \/etc\/NetworkManager\/system-connections\/\r\n[root@linuxprobe system-connections]# vim ens160.nmconnection\r\n[connection]\r\nid=ens160\r\ntype=ethernet\r\ninterface-name=ens160\r\nautoconnect=true\r\n[ipv4]\r\naddress1=192.168.10.10\/24\r\nmethod=manual\r\ngateway=192.168.10.10\r\ndns=192.168.10.10\r\n<\/pre>\n
\u3010\u6539\u6539\u6539\u3011<\/span><\/strong>[root@linuxprobe system-connections]# nmcli connection reload ens160\r\n[root@linuxprobe system-connections]# ping 192.168.10.10\r\nPING 192.168.10.10 (192.168.10.10) 56(84) bytes of data.\r\n64 bytes from 192.168.10.10: icmp_seq=1 ttl=64 time=0.091 ms\r\n64 bytes from 192.168.10.10: icmp_seq=2 ttl=64 time=0.035 ms\r\n64 bytes from 192.168.10.10: icmp_seq=3 ttl=64 time=0.045 ms\r\n64 bytes from 192.168.10.10: icmp_seq=4 ttl=64 time=0.095 ms\r\n^C\r\n--- 192.168.10.10 ping statistics ---\r\n4 packets transmitted, 4 received, 0% packet loss, time 3076ms\r\nrtt min\/avg\/max\/mdev = 0.035\/0.066\/0.095\/0.026 ms\r\n[root@linuxprobe system-connections]# \r\n<\/pre>\n
4.1.4 \u914d\u7f6e\u8f6f\u4ef6\u4ed3\u5e93<\/strong><\/span><\/h6>\n
[root@linuxprobe ~]# cd \/etc\/yum.repos.d\/\r\n[root@linuxprobe yum.repos.d]# vim rhel10.repo\r\n[BaseOS]\r\nname=BaseOS\r\nbaseurl=file:\/\/\/media\/cdrom\/BaseOS\r\nenabled=1\r\ngpgcheck=0\r\n[AppStream]\r\nname=AppStream\r\nbaseurl=file:\/\/\/media\/cdrom\/AppStream\r\nenabled=1\r\ngpgcheck=0\r\n<\/pre>\n
[root@linuxprobe yum.repos.d]# mkdir -p \/media\/cdrom \r\n[root@linuxprobe yum.repos.d]# mount \/dev\/cdrom \/media\/cdrom\r\nmount: \/media\/cdrom: WARNING: device write-protected, mounted read-only.\r\n[root@linuxprobe yum.repos.d]# vim \/etc\/fstab\r\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026\r\n\/dev\/cdrom \/media\/cdrom iso9660 defaults 0 0<\/pre>\n
[root@linuxprobe ~]# dnf install httpd -y\r\nUpdating Subscription Management repositories.\r\nUnable to read consumer identity\r\nBaseOS 18 MB\/s | 1.7 MB 00:00 \r\nAppStream 80 MB\/s | 6.3 MB 00:00 \r\nDependencies resolved.\r\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026\r\nInstalled:\r\n apr-1.7.0-11.el9.x86_64 apr-util-1.6.1-20.el9.x86_64 \r\n apr-util-bdb-1.6.1-20.el9.x86_64 apr-util-openssl-1.6.1-20.el9.x86_64 \r\n httpd-2.4.53-11.el9_2.4.x86_64 httpd-core-2.4.53-11.el9_2.4.x86_64 \r\n httpd-filesystem-2.4.53-11.el9_2.4.noarch httpd-tools-2.4.53-11.el9_2.4.x86_64 \r\n mod_http2-1.15.19-4.el9_2.4.x86_64 mod_lua-2.4.53-11.el9_2.4.x86_64 \r\n redhat-logos-httpd-90.4-1.el9.noarch \r\n\r\nComplete!\r\n<\/pre>\n
4.2 \u7f16\u5199Shell\u811a\u672c<\/strong><\/span><\/h5>\n
[root@linuxprobe ~]# echo $SHELL\r\n\/bin\/bash<\/pre>\n
4.2.1 \u7f16\u5199\u7b80\u5355\u7684\u811a\u672c<\/strong><\/span><\/h6>\n
[root@linuxprobe ~]# vim example.sh\r\n#!\/bin\/bash \r\n#For Example BY lrxjmw.cn \r\npwd \r\nls -al<\/pre>\n
[root@linuxprobe ~]# bash example.sh\r\n\/root\r\ntotal 48\r\ndr-xr-x---. 14 root root 4096 Jun 3 20:51 .\r\ndr-xr-xr-x. 18 root root 235 Sep 13 2024 ..\r\n-rw-------. 1 root root 978 Sep 13 2024 anaconda-ks.cfg\r\n-rw-------. 1 root root 243 Sep 13 2024 .bash_history\r\n-rw-r--r--. 1 root root 18 Aug 11 2024 .bash_logout\r\n-rw-r--r--. 1 root root 141 Aug 11 2024 .bash_profile\r\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026\r\n<\/pre>\n
[root@linuxprobe ~]# .\/example.sh\r\nbash: .\/example.sh: Permission denied\r\n[root@linuxprobe ~]# chmod u+x example.sh\r\n[root@linuxprobe ~]# .\/example.sh\r\n\/root\r\ntotal 48\r\ndr-xr-x---. 14 root root 4096 Jun 3 20:51 .\r\ndr-xr-xr-x. 18 root root 235 Sep 13 2024 ..\r\n-rw-------. 1 root root 978 Sep 13 2024 anaconda-ks.cfg\r\n-rw-------. 1 root root 243 Sep 13 2024 .bash_history\r\n-rw-r--r--. 1 root root 18 Aug 11 2024 .bash_logout\r\n-rw-r--r--. 1 root root 141 Aug 11 2024 .bash_profile\r\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026<\/pre>\n
4.2.2 \u63a5\u6536\u7528\u6237\u7684\u53c2\u6570<\/strong><\/span><\/h6>\n
[root@linuxprobe ~]# wc -l anaconda-ks.cfg \r\n43 anaconda-ks.cfg\r\n[root@linuxprobe ~]# wc -c anaconda-ks.cfg \r\n978 anaconda-ks.cfg\r\n[root@linuxprobe ~]# wc -w anaconda-ks.cfg \r\n93 anaconda-ks.cfg<\/pre>\n
[root@linuxprobe ~]# vim Example.sh\r\n#!\/bin\/bash\r\necho \"\u5f53\u524d\u811a\u672c\u540d\u79f0\u4e3a$0\"\r\necho \"\u603b\u5171\u6709$#\u4e2a\u53c2\u6570\uff0c\u5206\u522b\u662f$*\u3002\"\r\necho \"\u7b2c1\u4e2a\u53c2\u6570\u4e3a$1\uff0c\u7b2c5\u4e2a\u4e3a$5\u3002\"\r\n[root@linuxprobe ~]# bash Example.sh one two three four five six\r\n\u5f53\u524d\u811a\u672c\u540d\u79f0\u4e3aExample.sh\r\n\u603b\u5171\u67096\u4e2a\u53c2\u6570\uff0c\u5206\u522b\u662fone two three four five six\u3002\r\n\u7b2c1\u4e2a\u53c2\u6570\u4e3aone\uff0c\u7b2c5\u4e2a\u4e3afive\u3002\r\n<\/pre>\n
4.2.3 \u5224\u65ad\u7528\u6237\u7684\u53c2\u6570<\/strong><\/span><\/h6>\n
\n\n\n
\n \u64cd\u4f5c\u7b26<\/td>\n \u4f5c\u7528<\/td>\n<\/tr>\n \n -d<\/td>\n \u6d4b\u8bd5\u6587\u4ef6\u662f\u5426\u4e3a\u76ee\u5f55\u7c7b\u578b<\/td>\n<\/tr>\n \n -e<\/td>\n \u6d4b\u8bd5\u6587\u4ef6\u662f\u5426\u5b58\u5728<\/td>\n<\/tr>\n \n -f<\/td>\n \u5224\u65ad\u662f\u5426\u4e3a\u4e00\u822c\u6587\u4ef6<\/td>\n<\/tr>\n \n -r<\/td>\n \u6d4b\u8bd5\u5f53\u524d\u7528\u6237\u662f\u5426\u6709\u6743\u9650\u8bfb\u53d6<\/td>\n<\/tr>\n \n -w<\/td>\n \u6d4b\u8bd5\u5f53\u524d\u7528\u6237\u662f\u5426\u6709\u6743\u9650\u5199\u5165<\/td>\n<\/tr>\n \n -x<\/td>\n \u6d4b\u8bd5\u5f53\u524d\u7528\u6237\u662f\u5426\u6709\u6743\u9650\u6267\u884c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n [root@linuxprobe ~]# [ -d \/etc\/fstab ]\r\n[root@linuxprobe ~]# echo $?\r\n1\r\n<\/pre>\n
[root@linuxprobe ~]# [ -f \/etc\/fstab ]\r\n[root@linuxprobe ~]# echo $?\r\n0\r\n<\/pre>\n
[root@linuxprobe ~]# [ -e \/dev\/cdrom ] && echo \"Exist\"\r\nExist<\/pre>\n
[root@linuxprobe ~]# echo $USER\r\nroot\r\n[root@linuxprobe ~]# [ $USER = root ] || echo \"user\"\r\n[root@linuxprobe ~]# su - linuxprobe \r\n[linuxprobe@linuxprobe ~]$ [ $USER = root ] || echo \"user\"\r\nuser<\/pre>\n
[linuxprobe@linuxprobe ~]$ exit\r\nlogout\r\n[root@linuxprobe ~]# [ !<\/strong> $USER = root ] || echo \"administrator\"\r\nadministrator<\/pre>\n
Tips<\/strong><\/h3>\n<\/div>\n
[root@linuxprobe ~]# [ ! $USER = root ] && echo \"user\" || echo \"root\"\r\nroot<\/pre>\n
\n\n\n
\n \u64cd\u4f5c\u7b26<\/td>\n \u4f5c\u7528<\/td>\n<\/tr>\n \n -eq<\/td>\n \u662f\u5426\u7b49\u4e8e<\/td>\n<\/tr>\n \n -ne<\/td>\n \u662f\u5426\u4e0d\u7b49\u4e8e<\/td>\n<\/tr>\n \n -gt<\/td>\n \u662f\u5426\u5927\u4e8e<\/td>\n<\/tr>\n \n -lt<\/td>\n \u662f\u5426\u5c0f\u4e8e<\/td>\n<\/tr>\n \n -le<\/td>\n \u662f\u5426\u7b49\u4e8e\u6216\u5c0f\u4e8e<\/td>\n<\/tr>\n \n -ge<\/td>\n \u662f\u5426\u5927\u4e8e\u6216\u7b49\u4e8e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n [root@linuxprobe ~]# [ 10 -gt 10 ]\r\n[root@linuxprobe ~]# echo $?\r\n1<\/strong>\r\n[root@linuxprobe ~]# [ 10 -eq 10 ]\r\n[root@linuxprobe ~]# echo $?\r\n0\r\n<\/strong><\/pre>\n
[root@linuxprobe ~]# free -m\r\n total used free shared buff\/cache available\r\nMem: 1942 1432 126 18 561 510\r\nSwap: 2047 19 2028\r\n[root@linuxprobe ~]# free -m | grep Mem:\r\nMem:<\/strong> 1942 1432 126 18 561 510\r\n[root@linuxprobe ~]# free -m | grep Mem: | awk '{print $4}'\r\n126\r\n<\/pre>\n
[root@linuxprobe ~]# FreeMem=`free -m | grep Mem: | awk '{print $4}'`\r\n[root@linuxprobe ~]# echo $FreeMem \r\n126<\/pre>\n
[root@linuxprobe ~]# [ $FreeMem -lt 1024 ] && echo \"Insufficient Memory\"\r\nInsufficient Memory\r\n<\/pre>\n
\n\n
\n \u64cd\u4f5c\u7b26<\/td>\n \u4f5c\u7528<\/td>\n<\/tr>\n \n =<\/td>\n \u6bd4\u8f83\u5b57\u7b26\u4e32\u5185\u5bb9\u662f\u5426\u76f8\u540c<\/td>\n<\/tr>\n \n !=<\/td>\n \u6bd4\u8f83\u5b57\u7b26\u4e32\u5185\u5bb9\u662f\u5426\u4e0d\u540c<\/td>\n<\/tr>\n \n -z<\/td>\n \u5224\u65ad\u5b57\u7b26\u4e32\u5185\u5bb9\u662f\u5426\u4e3a\u7a7a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n [root@linuxprobe ~]# [ -z $String ]\r\n[root@linuxprobe ~]# echo $?\r\n0\r\n<\/pre>\n
[root@linuxprobe ~]# echo $LANG\r\nen_US.UTF-8\r\n[root@linuxprobe ~]# [ ! $LANG = \"en.US\" ] && echo \"Not en.US\"\r\nNot en.US\r\n<\/pre>\n