{"id":5348,"date":"2024-09-18T21:01:01","date_gmt":"2024-09-18T13:01:01","guid":{"rendered":""},"modified":"2024-09-18T21:01:01","modified_gmt":"2024-09-18T13:01:01","slug":"linux\u91cd\u5b9a\u5411\u662f\u4ec0\u4e48\u610f\u601d_linux\u57fa\u7840\u77e5\u8bc6\u70b9","status":"publish","type":"post","link":"https:\/\/mushiming.com\/5348.html","title":{"rendered":"linux\u91cd\u5b9a\u5411\u662f\u4ec0\u4e48\u610f\u601d_linux\u57fa\u7840\u77e5\u8bc6\u70b9"},"content":{"rendered":"<p id=\"main-toc\"><strong>\u76ee\u5f55<\/strong><\/p>\n<p id=\"%E4%B8%80%E3%80%81%E8%A7%A3%E9%87%8A%E5%9E%8B%E8%AF%AD%E8%A8%80%E5%92%8C%E7%BC%96%E8%AF%91%E5%9E%8B%E8%AF%AD%E8%A8%80-toc\" style=\"margin-left:0px;\">\u4e00\u3001\u89e3\u91ca\u578b\u8bed\u8a00\u548c\u7f16\u8bd1\u578b\u8bed\u8a00<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A01.1%20python%E8%A7%A3%E9%87%8A%E5%99%A8-toc\" style=\"margin-left:40px;\"> 1.1 python\u89e3\u91ca\u5668<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A01.2%20%E4%B8%8B%E8%BD%BD%E8%BD%AF%E4%BB%B6-toc\" style=\"margin-left:40px;\"> 1.2 \u4e0b\u8f7d\u8f6f\u4ef6<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A01.2.1%20wget-toc\" style=\"margin-left:80px;\"> 1.2.1 wget<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A01.2.2%20curl-toc\" style=\"margin-left:80px;\"> 1.2.2 curl<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A01.2.3%20%E5%8C%BA%E5%88%AB-toc\" style=\"margin-left:80px;\"> 1.2.3 \u533a\u522b<\/p>\n<p id=\"%E4%BA%8C%E3%80%81%E5%88%A4%E6%96%AD%E7%94%A8%E6%88%B7%E6%98%AF%E5%90%A6%E5%AD%98%E5%9C%A8-toc\" style=\"margin-left:0px;\">\u4e8c\u3001\u5224\u65ad\u7528\u6237\u662f\u5426\u5b58\u5728<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.1%20id-toc\" style=\"margin-left:40px;\"> 2.1 id<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.2%20cat%20%2Fetc%2Fpasswd-toc\" style=\"margin-left:40px;\"> 2.2 cat \/etc\/passwd<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.2.1%20grep-toc\" style=\"margin-left:80px;\"> 2.2.1 grep<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.3%20%E7%94%A8%E6%88%B7%E7%9A%84%E5%AE%B6%E7%9B%AE%E5%BD%95-toc\" style=\"margin-left:40px;\"> 2.3 \u7528\u6237\u7684\u5bb6\u76ee\u5f55<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.3.1%E3%80%90%E7%94%A8%E6%88%B7%E5%8F%AF%E4%BB%A5%E6%B2%A1%E6%9C%89%E5%AE%B6%E7%9B%AE%E5%BD%95%E3%80%91-toc\" style=\"margin-left:80px;\"> 2.3.1\u3010\u7528\u6237\u53ef\u4ee5\u6ca1\u6709\u5bb6\u76ee\u5f55\u3011<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.3.2%E3%80%90%E7%94%A8%E6%88%B7%E7%9A%84%E5%AE%B6%E7%9B%AE%E5%BD%95%E4%B8%8D%E5%9C%A8%2Fhome%E3%80%91-toc\" style=\"margin-left:80px;\"> 2.3.2\u3010\u7528\u6237\u7684\u5bb6\u76ee\u5f55\u4e0d\u5728\/home\u3011<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.3.3%20%E5%88%A0%E9%99%A4%E7%94%A8%E6%88%B7-toc\" style=\"margin-left:80px;\"> 2.3.3 \u5220\u9664\u7528\u6237<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.3.4%20%E5%88%87%E6%8D%A2%E7%94%A8%E6%88%B7%E7%9A%84%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9-toc\" style=\"margin-left:80px;\"> 2.3.4 \u5207\u6362\u7528\u6237\u7684\u6ce8\u610f\u4e8b\u9879<\/p>\n<p id=\"%E4%B8%89%E3%80%81%E3%80%90%E5%89%8D%E6%8F%90%E3%80%91%E9%87%8D%E5%AE%9A%E5%90%91-toc\" style=\"margin-left:0px;\">\u4e09\u3001\u3010\u524d\u63d0\u3011\u91cd\u5b9a\u5411<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.1%20%E6%A0%87%E5%87%86%E8%BE%93%E5%85%A5%E5%92%8C%E6%A0%87%E5%87%86%E8%BE%93%E5%87%BA-toc\" style=\"margin-left:40px;\"> 3.1 \u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.2%20%E8%AE%BE%E7%BD%AE%E7%94%A8%E6%88%B7%E5%AF%86%E7%A0%81-toc\" style=\"margin-left:40px;\"> 3.2 \u8bbe\u7f6e\u7528\u6237\u5bc6\u7801<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3%20%E8%84%9A%E6%9C%AC%E7%BB%83%E4%B9%A0-toc\" style=\"margin-left:40px;\"> 3.3 \u811a\u672c\u7ec3\u4e60<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.1%20if%E5%92%8C%24%3F-toc\" style=\"margin-left:80px;\"> 3.3.1 if\u548c$?<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.2.1%20shell%E5%AE%8C%E6%88%90-toc\" style=\"margin-left:80px;\"> 3.2.1 shell\u5b8c\u6210<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3%20%E8%BE%93%E5%85%A5%E8%BE%93%E5%87%BA%E9%87%8D%E5%AE%9A%E5%90%91-toc\" style=\"margin-left:40px;\"> 3.3 \u8f93\u5165\u8f93\u51fa\u91cd\u5b9a\u5411<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.1%20%26%3E-toc\" style=\"margin-left:80px;\"> 3.3.1 &><\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.2%20Linux%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9A%84%E7%90%86%E8%AE%BA%E7%9F%A5%E8%AF%86-toc\" style=\"margin-left:80px;\"> 3.3.2 Linux\u64cd\u4f5c\u7cfb\u7edf\u7684\u7406\u8bba\u77e5\u8bc6<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.3%20%E4%BA%A4%E4%BA%92%E5%BC%8F%E7%A1%AC%E4%BB%B6%E8%AE%BE%E5%A4%87-toc\" style=\"margin-left:80px;\"> 3.3.3 \u4ea4\u4e92\u5f0f\u786c\u4ef6\u8bbe\u5907<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.4%20%E7%BB%88%E7%AB%AF%EF%BC%88w%EF%BC%89-toc\" style=\"margin-left:80px;\"> 3.3.4 \u7ec8\u7aef\uff08w\uff09<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.5%20%E5%88%A9%E7%94%A8%E9%87%8D%E5%AE%9A%E5%90%91%E4%BB%8E%E4%B8%80%E4%B8%AA%E7%BB%88%E7%AB%AF%E8%BE%93%E5%87%BA%E5%88%B0%E5%8F%A6%E4%B8%80%E4%B8%AA%E7%BB%88%E7%AB%AF-toc\" style=\"margin-left:80px;\"> 3.3.5 \u5229\u7528\u91cd\u5b9a\u5411\u4ece\u4e00\u4e2a\u7ec8\u7aef\u8f93\u51fa\u5230\u53e6\u4e00\u4e2a\u7ec8\u7aef<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.6%20ulimit%20%E6%9F%A5%E7%9C%8BLinux%E5%86%85%E6%A0%B8%E7%9A%84%E9%99%90%E5%88%B6%E5%8F%82%E6%95%B0-toc\" style=\"margin-left:80px;\"> 3.3.6 ulimit \u67e5\u770bLinux\u5185\u6838\u7684\u9650\u5236\u53c2\u6570<\/p>\n<p id=\"%E5%9B%9B%E3%80%81%E7%BB%83%E4%B9%A0%EF%BC%88%E8%A1%A5%E5%85%85%EF%BC%9Akill%EF%BC%89-toc\" style=\"margin-left:0px;\">\u56db\u3001\u7ec3\u4e60\uff08\u8865\u5145\uff1akill\uff09<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A04.1%20kill%EF%BC%9A%E8%B8%A2%E5%87%BA%E5%85%B6%E4%BB%96%E9%9D%9E%E6%B3%95%E7%99%BB%E5%BD%95Linux%E7%B3%BB%E7%BB%9F%E7%9A%84%E7%94%A8%E6%88%B7-toc\" style=\"margin-left:40px;\"> 4.1 kill\uff1a\u8e22\u51fa\u5176\u4ed6\u975e\u6cd5\u767b\u5f55Linux\u7cfb\u7edf\u7684\u7528\u6237<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A04.2%20ssh%E8%BF%9C%E7%A8%8B%E7%99%BB%E5%BD%95-toc\" style=\"margin-left:40px;\"> 4.2 ssh\u8fdc\u7a0b\u767b\u5f55<\/p>\n<p id=\"%E4%BA%94%E3%80%81%E3%80%90%E4%BD%BF%E7%94%A8%E3%80%91%E9%87%8D%E5%AE%9A%E5%90%91-toc\" style=\"margin-left:0px;\">\u4e94\u3001\u3010\u4f7f\u7528\u3011\u91cd\u5b9a\u5411<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.1%20%E6%A0%87%E5%87%86%E6%AD%A3%E7%A1%AE%E8%BE%93%E5%87%BA%E9%87%8D%E5%AE%9A%E5%90%91%20%3E-toc\" style=\"margin-left:40px;\"> 5.1 \u6807\u51c6\u6b63\u786e\u8f93\u51fa\u91cd\u5b9a\u5411 ><\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.2%20%E6%A0%87%E5%87%86%E8%BE%93%E5%87%BA%E8%BF%BD%E5%8A%A0%E9%87%8D%E5%AE%9A%E5%90%91%20%3E%3E-toc\" style=\"margin-left:40px;\"> 5.2 \u6807\u51c6\u8f93\u51fa\u8ffd\u52a0\u91cd\u5b9a\u5411 >><\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.2.1%20%E5%A4%8D%E5%88%B6%E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9%E7%B2%98%E8%B4%B4%E5%88%B0%E5%8F%A6%E4%B8%80%E4%B8%AA%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:80px;\"> 5.2.1 \u590d\u5236\u6587\u4ef6\u5185\u5bb9\u7c98\u8d34\u5230\u53e6\u4e00\u4e2a\u6587\u4ef6<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.2.2%20%E5%90%88%E5%B9%B6%E4%B8%A4%E4%B8%AA%E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9-toc\" style=\"margin-left:80px;\"> 5.2.2 \u5408\u5e76\u4e24\u4e2a\u6587\u4ef6\u5185\u5bb9<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.3%20%E6%A0%87%E5%87%86%E9%94%99%E8%AF%AF%E8%BE%93%E5%87%BA%E9%87%8D%E5%AE%9A%E5%90%91%202%3E-toc\" style=\"margin-left:40px;\"> 5.3 \u6807\u51c6\u9519\u8bef\u8f93\u51fa\u91cd\u5b9a\u5411 2><\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.4%20%E5%90%8C%E6%97%B6%E4%BD%BF%E7%94%A81%3E%E5%92%8C2%3E-toc\" style=\"margin-left:40px;\"> 5.4 \u540c\u65f6\u4f7f\u75281>\u548c2><\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.5%20%E6%B8%85%E7%A9%BA%E6%96%87%E4%BB%B6%E4%BD%86%E4%B8%8D%E5%88%A0%E9%99%A4-toc\" style=\"margin-left:40px;\"> 5.5 \u6e05\u7a7a\u6587\u4ef6\u4f46\u4e0d\u5220\u9664<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.6%20%E6%AD%A3%E7%A1%AE%E5%92%8C%E9%94%99%E8%AF%AF%E8%BE%93%E5%87%BA%E9%87%8D%E5%AE%9A%E5%90%91-toc\" style=\"margin-left:40px;\"> 5.6 \u6b63\u786e\u548c\u9519\u8bef\u8f93\u51fa\u91cd\u5b9a\u5411<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.7%20%E6%A0%87%E5%87%86%E7%9A%84%E8%BE%93%E5%85%A5%E9%87%8D%E5%AE%9A%E5%90%91-toc\" style=\"margin-left:40px;\"> 5.7 \u6807\u51c6\u7684\u8f93\u5165\u91cd\u5b9a\u5411<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.8%20here%20document%EF%BC%88%E5%8D%B3-toc\" style=\"margin-left:40px;\"> 5.8 here document\uff08\u5373<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.8.1%20%E5%B0%86%E9%94%AE%E7%9B%98%E8%BE%93%E5%85%A5%E7%9A%84%E5%86%85%E5%AE%B9%E9%87%8D%E5%AE%9A%E5%90%91%E5%88%B0%E4%B8%80%E4%B8%AA%E6%96%87%E4%BB%B6%E9%87%8C-toc\" style=\"margin-left:80px;\"> 5.8.1 \u5c06\u952e\u76d8\u8f93\u5165\u7684\u5185\u5bb9\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u6587\u4ef6\u91cc<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.8.2%20%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA%E6%8C%87%E5%AE%9A%E5%86%85%E5%AE%B9%E7%9A%84%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:80px;\"> 5.8.2 \u751f\u6210\u4e00\u4e2a\u6307\u5b9a\u5185\u5bb9\u7684\u6587\u4ef6<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.9%20tee-toc\" style=\"margin-left:40px;\"> 5.9 tee<\/p>\n<p id=\"%E5%85%AD%E3%80%81%E8%AE%BE%E5%A4%87%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:0px;\">\u516d\u3001\u8bbe\u5907\u6587\u4ef6<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A06.1%20%2Fdev%2Fnull-toc\" style=\"margin-left:40px;\"> 6.1 \/dev\/null<\/p>\n<p id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A06.2%20%2Fdev%2Fzero-toc\" style=\"margin-left:40px;\"> 6.2 \/dev\/zero<\/p>\n<p id=\"%E4%B8%83%E3%80%81read%E9%9A%90%E8%97%8F%E8%BE%93%E5%85%A5%E7%9A%84%E5%AF%86%E7%A0%81-toc\" style=\"margin-left:0px;\">\u4e03\u3001read\u9690\u85cf\u8f93\u5165\u7684\u5bc6\u7801<\/p>\n<hr id=\"hr-toc\">\n<h2>\u4e00\u3001\u89e3\u91ca\u578b\u8bed\u8a00\u548c\u7f16\u8bd1\u578b\u8bed\u8a00<\/h2>\n<p><span style=\"color:#956fe7;\"><strong>c\u8bed\u8a00--\u7f16\u8bd1\u578b<\/strong><\/span>\uff1a\u4e00\u6b21\u6027\u7f16\u8bd1\u6210\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u7136\u540e\u6267\u884c\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u8ddf\u6e90\u4ee3\u7801\u6587\u4ef6\u65e0\u5173\u3002<\/p>\n<p> \u5982\u679cc\u8bed\u8a00\u6e90\u4ee3\u7801\u6587\u4ef6\u8fdb\u884c\u4e86\u4fee\u6539\uff0c\u5fc5\u987b\u8981\u91cd\u65b0\u7f16\u8bd1\uff0c\u751f\u6210\u65b0\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u7136\u540e\u53bb\u6267\u884c\u65b0\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u3002<\/p>\n<p><span style=\"color:#956fe7;\"><strong>python--\u89e3\u91ca\u578b<\/strong><\/span>\uff1a\u4e00\u884c\u4e00\u884c\u4ee3\u7801\u7684\u53bb\u89e3\u91ca\u6267\u884c\uff0c\u53ea\u8981\u6e90\u4ee3\u7801\u6709\u66f4\u65b0\u5c31\u4f1a\u91cd\u65b0\u6839\u636e\u6e90\u4ee3\u7801\u4e00\u884c\u4e00\u884c\u89e3\u91ca<\/p>\n<p>\u3010c\u7684\u901f\u5ea6\u8981\u6bd4python\u5feb\u3011<\/p>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A01.1%20python%E8%A7%A3%E9%87%8A%E5%99%A8\"> 1.1 python\u89e3\u91ca\u5668<\/h3>\n<p>pypy\u3001Cpython\uff08\u7528c\u8bed\u8a00\u5199\u7684\uff09\u3001Ipython\u3001Jpython\u3001Ironpython<\/p>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A01.2%20%E4%B8%8B%E8%BD%BD%E8%BD%AF%E4%BB%B6\"> 1.2 \u4e0b\u8f7d\u8f6f\u4ef6<\/h3>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A01.2.1%20wget\"> 1.2.1 wget<\/h4>\n<p>\u3010\u5b89\u88c5wget\u3011yum install wget -y<\/p>\n<p> wget\u662fLinux\u4e0b\u7684\u4e0b\u8f7d\u6587\u4ef6\uff0c\u7c7b\u4f3c\u4e8eLinux\u91cc\u7684\u8fc5\u96f7\u3002\u9ed8\u8ba4\u4e0b\u8f7d\u7684\u8f6f\u4ef6\u5b58\u653e\u5728\u5f53\u524d\u6587\u4ef6\u5939\u4e0b\u3002<\/p>\n<p>\u3010\u4f7f\u7528\u3011wget + \u94fe\u63a5\u5730\u5740<\/p>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A01.2.2%20curl\"> 1.2.2 curl<\/h4>\n<p> curl\u662fLinux\u4e0b\u7684\u5b57\u7b26\u754c\u9762\u7684\u6d4f\u89c8\u5668\uff0c\u4e5f\u53ef\u4ee5\u4e0b\u8f7d\u8f6f\u4ef6<\/p>\n<p>\u3010\u4f7f\u7528\u3011curl -O +\u94fe\u63a5\u5730\u5740<\/p>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A01.2.3%20%E5%8C%BA%E5%88%AB\"> 1.2.3 \u533a\u522b<\/h4>\n<p><strong>wget<\/strong>\uff1a\u7eaf\u4e0b\u8f7d\u8f6f\u4ef6\uff0c\u9700\u8981\u81ea\u5df1\u5b89\u88c5<\/p>\n<p><strong>curl<\/strong>\uff1aLinux\u91cc\u7684\u6d4f\u89c8\u5668\uff0c\u9ed8\u8ba4\u5c31\u6709\uff0c\u65e0\u9700\u5b89\u88c5<\/p>\n<h2 id=\"%E4%BA%8C%E3%80%81%E5%88%A4%E6%96%AD%E7%94%A8%E6%88%B7%E6%98%AF%E5%90%A6%E5%AD%98%E5%9C%A8\">\u4e8c\u3001\u5224\u65ad\u7528\u6237\u662f\u5426\u5b58\u5728<\/h2>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.1%20id\"> 2.1 id<\/h3>\n<p>\u67e5\u770b\u7528\u6237\u7684\u4fe1\u606f\uff0c\u53ef\u4ee5\u7528\u6765\u5224\u65ad\u7528\u6237\u662f\u5426\u5b58\u5728<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost sanchuang]# id lihua321 uid=1012(lihua321) gid=1012(lihua321) \u7ec4=1012(lihua321) \/ [root@localhost sanchuang]# id li id: li: no such user ==\u300b\u8bf4\u660e\u7528\u6237\u4e0d\u5b58\u5728<\/code><\/pre>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.2%20cat%20%2Fetc%2Fpasswd\"> 2.2 cat \/etc\/passwd<\/h3>\n<p>\u4e00\u884c\u4e00\u4e2a\u7528\u6237<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost sanchuang]# cat \/etc\/passwd | grep lihua ==\u300b\u548c\u7ba1\u9053\u7b26\u53f7\u548c\u8fc7\u6ee4\u547d\u4ee4\u914d\u5408\uff0c\u5224\u65ad\u7528\u6237lihua\u662f\u5426\u5b58\u5728\uff08\u4e0d\u51c6\u786e\uff09 lihua:x:1008:1008::\/home\/lihua:\/bin\/bash lihua321:x:1012:1012::\/home\/lihua321:\/bin\/bash [root@localhost sanchuang]# echo $? 0 [root@localhost sanchuang]# cat \/etc\/passwd | grep jinzh [root@localhost sanchuang]# echo $? 1 <\/code><\/pre>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.2.1%20grep\"> 2.2.1 grep<\/h4>\n<p>\u6587\u672c\u8fc7\u6ee4\uff0c\u4f1a\u6839\u636e\u5b57\u7b26\u4e32\u53bb\u5339\u914d\u5185\u5bb9\uff0c\u5982\u679c\u4e00\u884c\u91cc\u6709\u5339\u914d\u7684\u5b57\u7b26\u4e32\uff0c\u5c31\u5c06\u6574\u884c\u8f93\u51fa\u5230\u5c4f\u5e55\uff0c\u5982\u679c\u6ca1\u6709\u627e\u5230\u5c31\u4e0d\u8f93\u51fa\u3002<\/p>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.3%20%E7%94%A8%E6%88%B7%E7%9A%84%E5%AE%B6%E7%9B%AE%E5%BD%95\"> 2.3 \u7528\u6237\u7684\u5bb6\u76ee\u5f55<\/h3>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.3.1%E3%80%90%E7%94%A8%E6%88%B7%E5%8F%AF%E4%BB%A5%E6%B2%A1%E6%9C%89%E5%AE%B6%E7%9B%AE%E5%BD%95%E3%80%91\"> 2.3.1\u3010\u7528\u6237\u53ef\u4ee5\u6ca1\u6709\u5bb6\u76ee\u5f55\u3011<\/h4>\n<p><span style=\"color:#4da8ee;\">useradd -r hanmeimei<\/span><\/p>\n<p><strong>-r <\/strong>\u65b0\u5efa\u8fd9\u4e2a\u7528\u6237\u5c5e\u4e8e\u7cfb\u7edf\u7528\u6237\uff0c\u4e0d\u5efa\u7acb\u5bb6\u76ee\u5f55<\/p>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.3.2%E3%80%90%E7%94%A8%E6%88%B7%E7%9A%84%E5%AE%B6%E7%9B%AE%E5%BD%95%E4%B8%8D%E5%9C%A8%2Fhome%E3%80%91\"> 2.3.2\u3010\u7528\u6237\u7684\u5bb6\u76ee\u5f55\u4e0d\u5728\/home\u3011<\/h4>\n<p><span style=\"color:#4da8ee;\">useradd -d \/beijin xiaolihua<\/span><\/p>\n<p>\u5982\u6b64\uff0c\u7528\u6237xiaolihua\u7684\u5bb6\u76ee\u5f55\u5c31\u5728\/beijin<\/p>\n<p><strong>-d<\/strong> \u6307\u5b9a\u5bb6\u76ee\u5f55\u7684\u4f4d\u7f6e\uff0c\u9ed8\u8ba4\u662f\u653e\u5728\/home\u4e0b\uff0c\u53ef\u4ee5\u653e\u5230\u5176\u4ed6\u5730\u65b9<\/p>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.3.3%20%E5%88%A0%E9%99%A4%E7%94%A8%E6%88%B7\"> 2.3.3 \u5220\u9664\u7528\u6237<\/h4>\n<p><span style=\"color:#4da8ee;\">userdel -r xiaolihua<\/span><\/p>\n<p>\u5220\u9664\u7528\u6237xiaolihua\uff0c\u5e76\u4e14\u5220\u9664\u7528\u6237\u7684\u5bb6\u76ee\u5f55<\/p>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A02.3.4%20%E5%88%87%E6%8D%A2%E7%94%A8%E6%88%B7%E7%9A%84%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9\"> 2.3.4 \u5207\u6362\u7528\u6237\u7684\u6ce8\u610f\u4e8b\u9879<\/h4>\n<p><span style=\"color:#4da8ee;\">su - lihua<\/span><\/p>\n<p><strong>- <\/strong>\u4f1a\u52a0\u8f7d\u65b0\u7528\u6237\u7684\u73af\u5883\u53d8\u91cf\uff0c\u4e0d\u4f7f\u7528\u4e0a\u4e00\u4e2a\u7528\u6237\u7684\u73af\u5883\u53d8\u91cf<\/p>\n<h2 id=\"%E4%B8%89%E3%80%81%E3%80%90%E5%89%8D%E6%8F%90%E3%80%91%E9%87%8D%E5%AE%9A%E5%90%91\">\u4e09\u3001\u3010\u524d\u63d0\u3011\u91cd\u5b9a\u5411<\/h2>\n<p>\u91cd\u65b0\u5b9a\u4e49\u4e86\u4ed6\u7684\u8f93\u51fa\u65b9\u5411\u3002<\/p>\n<p>\u6539\u53d8\u547d\u4ee4\u7684\u8f93\u51fa\u65b9\u5411\uff0c\u672c\u6765\u6807\u51c6\u8f93\u51fa\u5f80\u5c4f\u5e55\u8f93\u51fa\uff0c\u91cd\u5b9a\u5411\u540e\u547d\u4ee4\u5c31\u8f93\u51fa\u5230\u6587\u4ef6\u3002<\/p>\n<p>\u4e0d\u4f1a\u5f71\u54cd\u547d\u4ee4\u7684\u8fd4\u56de\u503c<\/p>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.1%20%E6%A0%87%E5%87%86%E8%BE%93%E5%85%A5%E5%92%8C%E6%A0%87%E5%87%86%E8%BE%93%E5%87%BA\"> 3.1 \u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa<\/h3>\n<p><strong>\u6807\u51c6\u8f93\u5165\uff08STDIN\uff09<\/strong>\uff1astandard input ==\u300b\u63a5\u53d7\u4ece\u952e\u76d8\u8f93\u5165<\/p>\n<p>\u7ed9\u8ba1\u7b97\u673a\u8f93\u5165\u5185\u5bb9\u7684\u65b9\u5f0f\uff1a\u952e\u76d8\u8f93\u5165\u3001\u8bed\u8a00\u3001\u56fe\u5f62\u56fe\u50cf\uff08\u751f\u7269\u4fe1\u606f\u8bc6\u522b\uff09\u3001\u6587\u4ef6<\/p>\n<p><strong>\u6807\u51c6\u8f93\u51fa\uff08STDOUT\uff09<\/strong>\uff1astandard output ==\u300b\u90fd\u662f\u8f93\u51fa\u5230\u5c4f\u5e55<\/p>\n<p> \u5176\u4ed6\u8f93\u51fa\u65b9\u5f0f\uff1a\u6587\u4ef6<\/p>\n<p> 1.\u6b63\u786e\u7684\u6807\u51c6\u8f93\u51fa<\/p>\n<p> 2.\u9519\u8bef\u7684\u6807\u51c6\u8f93\u51fa<\/p>\n<p>\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u4eba\u548c\u8ba1\u7b97\u673a\u5728\u6c9f\u901a\u4ea4\u6d41\u65b9\u5f0f\u4e0a\u7684\u786e\u5b9a\u3002<\/p>\n<p>\u5e38\u89c1\u7684\u8fdb\u7a0b\u90fd\u4f1a\u6d89\u53ca\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\uff08\u7cfb\u7edf\u8c03\u7528\u548c\u5185\u6838\u91cc\u7684\u5185\u5bb9\u53ef\u80fd\u5c31\u6ca1\u6709\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\uff09<\/p>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.2%20%E8%AE%BE%E7%BD%AE%E7%94%A8%E6%88%B7%E5%AF%86%E7%A0%81\"> 3.2 \u8bbe\u7f6e\u7528\u6237\u5bc6\u7801<\/h3>\n<p><span style=\"color:#4da8ee;\">echo <\/span> \u662f\u5728\u5c4f\u5e55\u4e0a\u8f93\u51fa<\/p>\n<p><strong>| <\/strong>\u7ba1\u9053\u7b26\u53f7\uff1a\u662f\u5c06\u524d\u9762\u4e00\u4e2a\u547d\u4ee4\u7684\u6807\u51c6\u8f93\u51fa\u9001\u7ed9\u540e\u9762\u7684\u4e00\u4e2a\u547d\u4ee4\u4f5c\u4e3a\u6807\u51c6\u8f93\u5165<\/p>\n<p><strong>--stdin<\/strong> \u662fpasswd\u547d\u4ee4\u7684\u9009\u9879\uff1a\u4f5c\u7528\u662f\u544a\u8bc9passwd \u7ba1\u9053\u7b26\u53f7\u4f20\u6765\u7684\u5185\u5bb9\u662f\u53ef\u4ee5\u4f5c\u4e3a\u6807\u51c6\u8f93\u5165\u4f7f\u7528\u7684<\/p>\n<p>\u3010\u975e\u4ea4\u4e92\u5f0f\u8bbe\u7f6e\u5bc6\u7801\u3011<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost sanchuang]# useradd shijunhao ==\u300b\u65b0\u5efa\u7528\u6237shijunhao [root@localhost sanchuang]# echo |passwd shijunhao --stdin ==\u300b\u7ed9\u7528\u6237shijunhao\u8bbe\u7f6e\u5bc6\u7801 \u66f4\u6539\u7528\u6237 shijunhao \u7684\u5bc6\u7801 \u3002 passwd\uff1a\u6240\u6709\u7684\u8eab\u4efd\u9a8c\u8bc1\u4ee4\u724c\u5df2\u7ecf\u6210\u529f\u66f4\u65b0\u3002 <\/code><\/pre>\n<p>\u3010\u4ea4\u4e92\u5f0f\u8bbe\u7f6e\u5bc6\u7801\u3011<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost sanchuang]# passwd shijunhao \u66f4\u6539\u7528\u6237 shijunhao \u7684\u5bc6\u7801 \u3002 \u65b0\u7684 \u5bc6\u7801\uff1a \u65e0\u6548\u7684\u5bc6\u7801\uff1a \u5bc6\u7801\u5c11\u4e8e 8 \u4e2a\u5b57\u7b26 \u91cd\u65b0\u8f93\u5165\u65b0\u7684 \u5bc6\u7801\uff1a passwd\uff1a\u6240\u6709\u7684\u8eab\u4efd\u9a8c\u8bc1\u4ee4\u724c\u5df2\u7ecf\u6210\u529f\u66f4\u65b0\u3002 <\/code><\/pre>\n<p>\uff08\u5728\u7f16\u5199\u811a\u672c\u65f6\uff0c\u5e38\u7528\u975e\u4ea4\u4e92\u5f0f\u8bbe\u7f6e\u5bc6\u7801\uff0c\u7ed9\u7528\u6237\u8bbe\u7f6e\u5bc6\u7801\uff09<\/p>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3%20%E8%84%9A%E6%9C%AC%E7%BB%83%E4%B9%A0\"> 3.3 \u811a\u672c\u7ec3\u4e60<\/h3>\n<p>\u9898\u76ee\uff1a\u63a5\u53d7\u7528\u6237\u8f93\u5165\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u5e2e\u52a9\u65b0\u5efa\u7528\u6237\uff0c\u5e76\u4e14\u8bbe\u7f6e\u5bc6\u7801\u3002<\/p>\n<p>\uff08v2\u7248\u672c\uff09\uff08\u6dfb\u52a0\u529f\u80fd\uff09\u5982\u679c\u7528\u6237\u540d\u5b58\u5728\uff0c\u5c31\u63d0\u9192\u7528\u6237\u91cd\u65b0\u8f93\u5165\uff0c\u5982\u679c\u7528\u6237\u540d\u4e0d\u5b58\u5728\u5c31\u65b0\u5efa\u3002<\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528shell\u6216\u8005python<\/p>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.1%20if%E5%92%8C%24%3F\"> 3.3.1 if\u548c$?<\/h4>\n<p><strong>1.\u3010if\u8bed\u53e5\u7684\u8bed\u6cd5\u3011<\/strong><\/p>\n<pre class=\"language-java prettyprint linenums\"><code>if \u547d\u4ee4 then \u547d\u4ee41 ==>\u547d\u4ee4\u6267\u884c\u6210\u529f\u65f6\u6267\u884c else \u547d\u4ee42 ==>\u547d\u4ee4\u6267\u884c\u5931\u8d25\u65f6\u6267\u884c fi<\/code><\/pre>\n<p><strong>2.echo $?<\/strong><\/p>\n<p>\u8f93\u51fa\u4e0a\u4e00\u6761\u547d\u4ee4\u7684\u8fd4\u56de\u503c\u3002\u4e3a0\u65f6\uff0c\u8868\u793a\u6267\u884c\u6210\u529f\uff1b\u975e0\u65f6\uff0c\u8868\u793a\u6267\u884c\u5931\u8d25\u3002<\/p>\n<p>\u5e38\u89c1\u7684\u975e0\u8fd4\u56de\u503c\uff1a1\uff0c2\uff0c127<\/p>\n<p> <span style=\"color:#956fe7;\"><strong>127 <\/strong><\/span>\u8868\u793a\u547d\u4ee4\u4e0d\u5b58\u5728<\/p>\n<p> <span style=\"color:#956fe7;\"><strong> 1 <\/strong><\/span>\u8868\u793a\u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u53c2\u6570\u6216\u8005\u9009\u9879\u4e0d\u5bf9<\/p>\n<p> <span style=\"color:#956fe7;\"><strong> 2<\/strong><\/span> \u8868\u793a\u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u9009\u9879\u4e0d\u5bf9<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost sanchuang]# echo $? 0 [root@localhost sanchuang]# id jinzhi id: jinzhi: no such user [root@localhost sanchuang]# echo $? 1 <\/code><\/pre>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.2.1%20shell%E5%AE%8C%E6%88%90\"> 3.2.1 shell\u5b8c\u6210<\/h4>\n<p>\u3010\u9700\u6c42\u5206\u6790\u3011<\/p>\n<p> \u63a5\u53d7\u7528\u6237\u8f93\u5165\uff1aread<\/p>\n<p> \u65b0\u5efa\u7528\u6237\uff1auseradd<\/p>\n<p> \u8bbe\u7f6e\u5bc6\u7801\uff1apasswd<\/p>\n<p> \u811a\u672c\u540d\u5b57\uff1acreate_user_pwd.sh<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost sanchuang]# vim create_user_pwd.sh [root@localhost sanchuang]# cat create_user_pwd.sh #!\/bin\/bash #\u63a5\u53d7\u7528\u6237\u7684\u8f93\u5165 read -p \"\u8bf7\u8f93\u5165\u7528\u6237\u540d\uff1a\" u_name read -p \"\u8bf7\u8f93\u5165\u9700\u8981\u7ed9\u7528\u6237\u8bbe\u7f6e\u7684\u5bc6\u7801\uff1a\" u_pwd #\u65b0\u5efa\u7528\u6237\u548c\u8bbe\u7f6e\u5bc6\u7801 useradd $u_name echo $u_pwd | passwd $u_name --stdin [root@localhost sanchuang]# bash create_user_pwd.sh \u8bf7\u8f93\u5165\u7528\u6237\u540d\uff1alihua321 \u8bf7\u8f93\u5165\u9700\u8981\u7ed9\u7528\u6237\u8bbe\u7f6e\u7684\u5bc6\u7801\uff1a \u66f4\u6539\u7528\u6237 lihua321 \u7684\u5bc6\u7801 \u3002 passwd\uff1a\u6240\u6709\u7684\u8eab\u4efd\u9a8c\u8bc1\u4ee4\u724c\u5df2\u7ecf\u6210\u529f\u66f4\u65b0\u3002 [root@localhost sanchuang]# id lihua321 uid=1012(lihua321) gid=1012(lihua321) \u7ec4=1012(lihua321) \/ [root@localhost sanchuang]# id li id: li: no such user <\/code><\/pre>\n<p>\ud83d\udc4dshell\u811a\u672c\u5728\u6267\u884c\u7684\u65f6\u5019\u65f6\u4ece\u4e0a\u800c\u4e0b\uff0c\u4e00\u6761\u4e00\u6761\u6267\u884c\uff0c\u4e2d\u95f4\u67d0\u6761\u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u540e\u9762\u7684\u547d\u4ee4\u4f9d\u7136\u4f1a\u6267\u884c\u3002<\/p>\n<p>\ud83d\udc4dpython\u811a\u672c\u5728\u6267\u884c\u7684\u65f6\u5019\u65f6\u4ece\u4e0a\u800c\u4e0b\uff0c\u4e00\u6761\u4e00\u6761\u6267\u884c\uff0c\u4e2d\u95f4\u67d0\u6761\u547d\u4ee4\u6267\u884c\u5931\u8d25\uff0c\u540e\u9762\u7684\u547d\u4ee4\u4e0d\u4f1a\u6267\u884c\u3002<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost sanchuang]# bash create_user_pwd.sh \u8bf7\u8f93\u5165\u7528\u6237\u540d\uff1alihua321 \u8bf7\u8f93\u5165\u9700\u8981\u7ed9\u7528\u6237\u8bbe\u7f6e\u7684\u5bc6\u7801\uff1a12345 useradd\uff1a\u7528\u6237\u201clihua321\u201d\u5df2\u5b58\u5728 \u66f4\u6539\u7528\u6237 lihua321 \u7684\u5bc6\u7801 \u3002 passwd\uff1a\u6240\u6709\u7684\u8eab\u4efd\u9a8c\u8bc1\u4ee4\u724c\u5df2\u7ecf\u6210\u529f\u66f4\u65b0\u3002 <\/code><\/pre>\n<p><strong>\u3010v2\u7248\u672c\u3011<\/strong><\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost sanchuang]# cat create_user_pwd.sh #!\/bin\/bash #\u63a5\u53d7\u7528\u6237\u7684\u8f93\u5165 read -p \"\u8bf7\u8f93\u5165\u7528\u6237\u540d\uff1a\" u_name #\u65b0\u5efa\u7528\u6237\u548c\u8bbe\u7f6e\u5bc6\u7801 #if\u662f\u5224\u65ad\u7528\u6237\u662f\u5426\u5b58\u5728\uff0c\u5b58\u5728\u7ed9\u4e88\u63d0\u9192\uff0c\u4e0d\u5b58\u5728\u5c31\u65b0\u5efa\u5e76\u8bbe\u7f6e\u5bc6\u7801 if id $u_name &>\/dev\/null then echo \"\u7528\u6237 $u_name \u5b58\u5728\" else useradd $u_name echo $u_pwd | passwd $u_name --stdin read -p \"\u8bf7\u8f93\u5165\u9700\u8981\u7ed9\u7528\u6237\u8bbe\u7f6e\u7684\u5bc6\u7801\uff1a\" u_pwd fi <\/code><\/pre>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3%20%E8%BE%93%E5%85%A5%E8%BE%93%E5%87%BA%E9%87%8D%E5%AE%9A%E5%90%91\"> 3.3 \u8f93\u5165\u8f93\u51fa\u91cd\u5b9a\u5411<\/h3>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.1%20%26%3E\"> 3.3.1 &><\/h4>\n<p>&>\/dev\/null<\/p>\n<p>\u4e0d\u7ba1\u6b63\u786e\u7684\u8fd8\u662f\u9519\u8bef\u7684\u8f93\u51fa\uff0c\u90fd\u91cd\u5b9a\u5411\u5230\u6587\u4ef6\/dev\/null\/<\/p>\n<p>\/dev\/null\u662f\u4e00\u4e2a\u7279\u6b8a\u6587\u4ef6\uff0c\u4efb\u4f55\u5185\u5bb9\u91cd\u5b9a\u5411\u5230\u8fd9\u4e2a\u6587\u4ef6\uff0c\u90fd\u4e0d\u4f1a\u4fdd\u5b58\uff0c\u81ea\u52a8\u6d88\u5931\u3002<\/p>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.2%20Linux%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9A%84%E7%90%86%E8%AE%BA%E7%9F%A5%E8%AF%86\"> 3.3.2 Linux\u64cd\u4f5c\u7cfb\u7edf\u7684\u7406\u8bba\u77e5\u8bc6<\/h4>\n<p><span style=\"color:#fe2c24;\"><strong>\/proc<\/strong><\/span> \u5b58\u653eLinux\u5185\u6838\u4fe1\u606f\u7684\u5730\u65b9\u3002\u5916\u9762\u7684\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\/proc\u6587\u4ef6\u5939\u53bb\u8bbf\u95ee\u5185\u5b58\u91cc\u7684\u4fe1\u606f\u3002processes<\/p>\n<p> \/proc\u91cc\u7684\u4fe1\u606f\u662f\u5b58\u653e\u5728\u5185\u5b58\u91cc\u7684\uff0c\u505c\u7535\u4f1a\u4e22\u5931\u3002<\/p>\n<p> \u91cc\u9762\u6570\u5b57\u6587\u4ef6\u5939\u662f\u6bcf\u4e2a\u8fdb\u7a0b\u7684\u4fe1\u606f<\/p>\n<p> cpuinfo =\u300bcpu\u7684\u57fa\u672c\u4fe1\u606f information<\/p>\n<p> meminfo ==\u300b \u5185\u5b58\u7684\u57fa\u672c\u4fe1\u606f<\/p>\n<p><span style=\"color:#fe2c24;\"><strong>\u5185\u6838 kernel<\/strong><\/span>\uff1aLinux\u7cfb\u7edf\u6700\u6838\u5fc3\u7684\u8f6f\u4ef6<\/p>\n<ul>\n<li>\n<ol>\n<li>\u5bf9cpu\u8fdb\u884c\u8c03\u5ea6\u7ba1\u7406<\/li>\n<li>\u5bf9\u5185\u5b58\u8fdb\u884c\u5206\u914d<\/li>\n<li>\u5bf9\u78c1\u76d8\u8fdb\u884c\u7ba1\u7406<\/li>\n<li>\u5bf9\u8fdb\u7a0b\u8fdb\u884c\u7ba1\u7406<\/li>\n<li>\u5bf9\u5176\u4ed6\u7684\u786c\u4ef6\u8fdb\u884c\u7ba1\u7406<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p><strong><span style=\"color:#fe2c24;\">echo $$<\/span><\/strong><\/p>\n<p> \u5f53\u524dshell\u7684\u8fdb\u7a0b\u53f7\uff1a\u5f53\u524dxshell\u91cc\u7684\u7ec8\u7aef\u7684pid\u53f7\uff08\u8fdb\u7a0b\u53f7\uff09<\/p>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.3%20%E4%BA%A4%E4%BA%92%E5%BC%8F%E7%A1%AC%E4%BB%B6%E8%AE%BE%E5%A4%87\"> 3.3.3 \u4ea4\u4e92\u5f0f\u786c\u4ef6\u8bbe\u5907<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/f25ce0cc088f4062975830fc99d91328.png\" =\"\" =\"\" alt=\"linux\u91cd\u5b9a\u5411\u662f\u4ec0\u4e48\u610f\u601d_linux\u57fa\u7840\u77e5\u8bc6\u70b9 (https:\/\/mushiming.com\/) \u7b2c1\u5f20\" title=\"linux\u91cd\u5b9a\u5411\u662f\u4ec0\u4e48\u610f\u601d_linux\u57fa\u7840\u77e5\u8bc6\u70b9 \u7b2c1\u5f20-\u7a46\u4e16\u660e\u535a\u5ba2\" ><\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost sanchuang]# ll \/dev\/std* lrwxrwxrwx. 1 root root 15 3\u6708 20 14:51 \/dev\/stderr -> \/proc\/self\/fd\/2 lrwxrwxrwx. 1 root root 15 3\u6708 20 14:51 \/dev\/stdin -> \/proc\/self\/fd\/0 lrwxrwxrwx. 1 root root 15 3\u6708 20 14:51 \/dev\/stdout -> \/proc\/self\/fd\/1 <\/code><\/pre>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.4%20%E7%BB%88%E7%AB%AF%EF%BC%88w%EF%BC%89\"> 3.3.4 \u7ec8\u7aef\uff08w\uff09<\/h4>\n<p>Linux\u91cc\u4e00\u5207\u7686\u6587\u4ef6 =\u300b<strong>\u4efb\u4f55\u786c\u4ef6<\/strong>\uff08\u5305\u62ec\u5c4f\u5e55\u7b49\uff09\u90fd\u4f1a\u6709\u4e00\u4e2a\u6587\u4ef6\u548c\u5b83\u5bf9\u5e94<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\"> [root@localhost fd]# ll \/dev\/stdin lrwxrwxrwx. 1 root root 15 3\u6708 20 14:51 \/dev\/stdin -> \/proc\/self\/fd\/0 [root@localhost fd]# ll \/proc\/self\/fd \u603b\u7528\u91cf 0 lrwx------. 1 root root 64 3\u6708 23 10:31 0 -> \/dev\/pts\/0 lrwx------. 1 root root 64 3\u6708 23 10:31 1 -> \/dev\/pts\/0 lrwx------. 1 root root 64 3\u6708 23 10:31 2 -> \/dev\/pts\/0 lr-x------. 1 root root 64 3\u6708 23 10:31 3 -> \/proc\/21604\/fd <\/code><\/pre>\n<p>\/dev\/stdin \uff08\u94fe\u63a5)==> \/proc\/self\/fd\/0 \uff08\u94fe\u63a5)==> \/dev\/pts\/0<\/p>\n<p><strong>\/dev\/pts\/0<\/strong> \u7ec8\u7aef\u8bbe\u5907\u7684\u6587\u4ef6\u540d<\/p>\n<p><strong>w <\/strong>\u67e5\u770b\u5f53\u524dLinux\u767b\u5f55\u7684\u7528\u6237\u60c5\u51b5<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost ~]# w 12:48:53 up 1 min, 2 users, load average: 0.22, 0.10, 0.04 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root tty1 12:48 45.00s 0.01s 0.01s -bash root pts\/0 192.168.255.1 12:48 5.00s 0.01s 0.00s w <\/code><\/pre>\n<p><span style=\"color:#4da8ee;\"><strong>12:48:53<\/strong><\/span> \u8868\u793a\u5f53\u524d\u65f6\u95f4<\/p>\n<p><span style=\"color:#4da8ee;\"><strong>up 1 min<\/strong><\/span> \u8868\u793a\u5f00\u673a\u542f\u52a8\u591a\u957f\u65f6\u95f4\u3002<\/p>\n<p><span style=\"color:#4da8ee;\"><strong>2 users<\/strong><\/span> \u8868\u793a\u4e24\u4e2a\u7528\u6237\u767b\u5f55<\/p>\n<p><span style=\"color:#4da8ee;\"><strong>TTY<\/strong><\/span> \u8868\u793a\u7ec8\u7aef\u7c7b\u578b\u3002<\/p>\n<p> \u7ec8\u7aef\uff1a\u9762\u5411\u6700\u7ec8\u7528\u6237\u7684\u7aef\u53e3<\/p>\n<p><span style=\"color:#fe2c24;\"><strong> tty1<\/strong><\/span> ==\u300b\u76f4\u63a5\u767b\u5f55\u64cd\u7eb5\u7684\u7b2c1\u4e2a\u7ec8\u7aef\u3002--\u6b63\u5f0f\u5458\u5de5---\u771f\u6b63\u7684\u7ec8\u7aef<\/p>\n<p> Linux\u91cc\u6700\u591a\u5141\u8bb86\u4e2a\u53ef\u4ee5\u76f4\u63a5\u767b\u5f55\u7684\u7ec8\u7aef\uff08tty1~tty6)<\/p>\n<p> <span style=\"color:#956fe7;\"><strong> \u3010\u5f00\u542ftty\u7ec8\u7aef\u3011ALT+F2<\/strong><\/span>\uff08F3\u3001F4\u3001F5\u3001F6\uff09 ==> tty2(tty3\u3001tty4\u3001tty5\u3001tty6)\u3002<\/p>\n<p> \u67d0\u4e2a\u7ec8\u7aef\u5361\u4f4f\u53ef\u4ee5\u6253\u5f00\u53e6\u4e00\u4e2a\u7ec8\u7aef\u3002<\/p>\n<p><strong> <span style=\"color:#fe2c24;\"> pts\/0 <\/span><\/strong>==\u300b\/dev\/pts\u6587\u4ef6\u5939\u4e0b\u7684\u7b2c0\u4e2a\u7ec8\u7aef\u6587\u4ef6<\/p>\n<p> pts\u6587\u4ef6\u5939\u4e0b\u662f\u8fdc\u7a0b\u767b\u5f55\u8fc7\u6765\u7684\u7ec8\u7aef\u7c7b\u578b\uff1a\u4eff\u7ec8\u7aef---\u6a21\u62df\u7ec8\u7aef---\u4e34\u65f6\u5de5\uff08\u6570\u91cf\u4e0d\u53d7\u9650\u5236\uff09<\/p>\n<p> \u3010\u5f00\u542f\u3011\u590d\u5236\u6807\u7b7e\u53ef\u4ee5\u4ea7\u751f\uff08pts\/1\u3001pts\/2\u2026\u2026\uff09<\/p>\n<p><span style=\"color:#4da8ee;\"><strong>WHAT <\/strong><\/span>\u8868\u793a\u7528\u6237\u767b\u5f55\u8fdb\u5165Linux\u7cfb\u7edf\uff0c\u6b63\u5728\u4f7f\u7528\u7684\u547d\u4ee4<\/p>\n<p><span style=\"color:#4da8ee;\"><strong>FROM<\/strong><\/span> \u8868\u793a\u7528\u6237\u4ece\u54ea\u91cc\u767b\u5f55\u8fc7\u6765\u7684<\/p>\n<p> <span style=\"color:#956fe7;\"> 192.168.255.1 <\/span>\u4ece\u8fd9\u4e2aip\u5730\u5740\u8fdc\u7a0b\u767b\u5f55\u8fc7\u6765\u7684<\/p>\n<p> <span style=\"color:#956fe7;\"> - <\/span>\u8868\u793a\u672c\u5730\u76f4\u63a5\u767b\u5f55<\/p>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.5%20%E5%88%A9%E7%94%A8%E9%87%8D%E5%AE%9A%E5%90%91%E4%BB%8E%E4%B8%80%E4%B8%AA%E7%BB%88%E7%AB%AF%E8%BE%93%E5%87%BA%E5%88%B0%E5%8F%A6%E4%B8%80%E4%B8%AA%E7%BB%88%E7%AB%AF\"> 3.3.5 \u5229\u7528\u91cd\u5b9a\u5411\u4ece\u4e00\u4e2a\u7ec8\u7aef\u8f93\u51fa\u5230\u53e6\u4e00\u4e2a\u7ec8\u7aef<\/h4>\n<p>\u5f80\/dev\/pts\/1\u8fd9\u4e2a\u6587\u4ef6\u91cc\u8f93\u5165\u5185\u5bb9\uff0c\u5bf9\u5e94\/dev\/pts\/1\u8fd9\u4e2abash\u8fdb\u7a0b\u4f1a\u6536\u5230\u76f8\u5e94\u6d88\u606f<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost pts]# echo \"hello,lihua\" >\/dev\/pts\/1 <\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/b31d70d986554660b5fee637dafbd820.png\" =\"\" =\"\" alt=\"linux\u91cd\u5b9a\u5411\u662f\u4ec0\u4e48\u610f\u601d_linux\u57fa\u7840\u77e5\u8bc6\u70b9 (https:\/\/mushiming.com\/) \u7b2c2\u5f20\" title=\"linux\u91cd\u5b9a\u5411\u662f\u4ec0\u4e48\u610f\u601d_linux\u57fa\u7840\u77e5\u8bc6\u70b9 \u7b2c2\u5f20-\u7a46\u4e16\u660e\u535a\u5ba2\" ><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/f77b690f05124105bcb1dc248366a303.png\" =\"\" =\"\" alt=\"linux\u91cd\u5b9a\u5411\u662f\u4ec0\u4e48\u610f\u601d_linux\u57fa\u7840\u77e5\u8bc6\u70b9 (https:\/\/mushiming.com\/) \u7b2c3\u5f20\" title=\"linux\u91cd\u5b9a\u5411\u662f\u4ec0\u4e48\u610f\u601d_linux\u57fa\u7840\u77e5\u8bc6\u70b9 \u7b2c3\u5f20-\u7a46\u4e16\u660e\u535a\u5ba2\" ><\/p>\n<p><span style=\"color:#956fe7;\"><strong>wall \u5e7f\u64ad\u8f93\u51fa<\/strong><\/span><\/p>\n<p>\u666e\u901a\u7528\u6237\u4e0d\u53ef\u4ee5\uff0c\u6743\u9650\u4e0d\u591f\uff08root\u7528\u6237\u624d\u53ef\u4ee5\uff09<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost pts]# wall hello<\/code><\/pre>\n<p>3.3.6 fd\uff08\u6587\u4ef6\u63cf\u8ff0\u7b26\uff09<\/p>\n<p> file descriptor<\/p>\n<p><span style=\"color:#fe2c24;\"><strong>\u6587\u4ef6\u63cf\u8ff0\u7b26<\/strong><\/span>\uff1aLinux\u5185\u6838\u7ed9\u6bcf\u4e2a\u8fdb\u7a0b\u521b\u5efa\u4e86\u4e00\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\u8868\uff0c\u8fd9\u4e2a\u8868\u91cc\u8bb0\u8f7d\u8fd9\u4e2a\u8fdb\u7a0b\u6253\u5f00\u7684\u6240\u6709\u6587\u4ef6\u3002<\/p>\n<p>\u4e3a\u4e86\u65b9\u4fbf\u8fdb\u7a0b\u77e5\u9053\u81ea\u5df1\u6253\u5f00\u4e86\u54ea\u4e9b\u6587\u4ef6\uff0c\u5c31\u7ed9\u6bcf\u4e2a\u6587\u4ef6\u8fdb\u884c\u4e86\u7f16\u53f7\uff0c\u8fd9\u4e2a\u7f16\u53f7\u5c31\u662f\u6587\u4ef6\u63cf\u8ff0\u7b26\u3002<\/p>\n<p>\u8fdb\u7a0b\u5bf9\u6587\u4ef6\u8fdb\u884c\u8bfb\u5199\u64cd\u4f5c\u7684\u65f6\u5019\uff0c\u5c31\u76f4\u63a5\u4f7f\u7528\u5bf9\u5e94\u7684\u7f16\u53f7\u4e86\uff0c\u4e0d\u518d\u4f7f\u7528\u6587\u4ef6\u540d\u3002<\/p>\n<p><strong>\u6bcf\u4e00\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\u4f1a\u4e0e\u4e00\u4e2a\u6253\u5f00\u6587\u4ef6\u76f8\u5bf9\u5e94\uff0c\u540c\u65f6\uff0c\u4e0d\u540c\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26\u4e5f\u4f1a\u6307\u5411\u540c\u4e00\u4e2a\u6587\u4ef6<\/strong>\u3002\u76f8\u540c\u7684\u6587\u4ef6\u53ef\u4ee5\u88ab\u4e0d\u540c\u7684\u8fdb\u7a0b\u6253\u5f00\u4e5f\u53ef\u4ee5\u5728\u540c\u4e00\u4e2a\u8fdb\u7a0b\u4e2d\u88ab\u591a\u6b21\u6253\u5f00\u3002\u7cfb\u7edf\u4e3a\u6bcf\u4e00\u4e2a\u8fdb\u7a0b\u7ef4\u62a4\u4e86\u4e00\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\u8868\uff0c\u8be5\u8868\u7684\u503c\u90fd\u662f\u4ece0\u5f00\u59cb\u7684\uff0c\u6240\u4ee5\u5728\u4e0d\u540c\u7684\u8fdb\u7a0b\u4e2d\u4f60\u4f1a\u770b\u5230\u76f8\u540c\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u76f8\u540c\u6587\u4ef6\u63cf\u8ff0\u7b26\u6709\u53ef\u80fd\u6307\u5411\u540c\u4e00\u4e2a\u6587\u4ef6\uff0c\u4e5f\u6709\u53ef\u80fd\u6307\u5411\u4e0d\u540c\u7684\u6587\u4ef6\u3002\u3010\u8be6\u60c5\u94fe\u63a5\uff1a\u6587\u4ef6\u63cf\u8ff0\u7b26 - \u7b80\u4e66\u3011<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost proc]# echo $$ 7963 [root@localhost proc]# cd 7963 [root@localhost 7963]# ls attr cwd map_files oom_adj schedstat task autogroup environ maps oom_score sessionid timers auxv exe mem oom_score_adj setgroups uid_map cgroup fd mountinfo pagemap smaps wchan clear_refs fdinfo mounts patch_state stack cmdline gid_map mountstats personality stat comm io net projid_map statm coredump_filter limits ns root status cpuset loginuid numa_maps sched syscall [root@localhost 7963]# cd fd [root@localhost fd]# ls 0 1 2 255 [root@localhost fd]# ll \u603b\u7528\u91cf 0 lrwx------. 1 root root 64 3\u6708 21 18:14 0 -> \/dev\/pts\/0 lrwx------. 1 root root 64 3\u6708 21 18:14 1 -> \/dev\/pts\/0 lrwx------. 1 root root 64 3\u6708 21 18:14 2 -> \/dev\/pts\/0 lrwx------. 1 root root 64 3\u6708 21 23:12 255 -> \/dev\/pts\/0 <\/code><\/pre>\n<p>\u5185\u6838\uff08kernel\uff09\u5229\u7528\u6587\u4ef6\u63cf\u8ff0\u7b26\uff08file descriptor\uff09\u6765\u8bbf\u95ee\u6587\u4ef6\u3002\u6587\u4ef6\u63cf\u8ff0\u7b26\u662f\u975e\u8d1f\u6574\u6570\u3002<\/p>\n<p> 0 ==\u300b\u6807\u51c6\u8f93\u5165 ==\u300b \/dev\/pts\/0<\/p>\n<p> 1 ==\u300b\u6807\u51c6\u6b63\u786e\u8f93\u51fa ==\u300b \/dev\/pts\/0<\/p>\n<p> 2 ==\u300b\u6807\u51c6\u9519\u8bef\u8f93\u51fa ==\u300b \/dev\/pts\/0<\/p>\n<p>\u53ea\u8981\u6709\u8f93\u5165\u8f93\u51fa\u7684\u7a0b\u5e8f\uff0c\u4ed6\u90fd\u67090 1 2 \u8fd93\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\u3010\u5bf9\u5e94\u7684\u90fd\u662f\u540c\u4e00\u4e2a\u6587\u4ef6\uff0c\u53ea\u662f\u6709\u4e0d\u540c\u7684\u7f16\u53f7\u3011<\/p>\n<p>Linux\u64cd\u4f5c\u7cfb\u7edf\u9ed8\u8ba4\u4e00\u4e2a\u8fdb\u7a0b\u53ea\u80fd\u6253\u5f001024\u4e2a\u6587\u4ef6<\/p>\n<p>\u6240\u4ee5\u9ed8\u8ba4\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26\u7684\u8303\u56f4\uff1a<span style=\"color:#956fe7;\"><strong>0~1023<\/strong><\/span><\/p>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A03.3.6%20ulimit%20%E6%9F%A5%E7%9C%8BLinux%E5%86%85%E6%A0%B8%E7%9A%84%E9%99%90%E5%88%B6%E5%8F%82%E6%95%B0\"> 3.3.6 ulimit \u67e5\u770bLinux\u5185\u6838\u7684\u9650\u5236\u53c2\u6570<\/h4>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\"> [root@localhost pts]# ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 7183 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 ==\u300b\u5bf9\u4e00\u4e2a\u8fdb\u7a0b\u53ef\u4ee5\u6253\u5f00\u591a\u5c11\u4e2a\u6587\u4ef6\u8fdb\u884c\u9650\u5236 <\/code><\/pre>\n<p>\u3010\u4e34\u65f6\u4fee\u6539\u3011<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost pts]# ulimit -n [root@localhost pts]# ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 7183 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) [root@localhost pts]# ulimit -n <\/code><\/pre>\n<h2 id=\"%E5%9B%9B%E3%80%81%E7%BB%83%E4%B9%A0%EF%BC%88%E8%A1%A5%E5%85%85%EF%BC%9Akill%EF%BC%89\">\u56db\u3001\u7ec3\u4e60\uff08\u8865\u5145\uff1akill\uff09<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/3cf660b22fb7412aa242b47795f0f2c8.png\" =\"\" =\"\" alt=\"linux\u91cd\u5b9a\u5411\u662f\u4ec0\u4e48\u610f\u601d_linux\u57fa\u7840\u77e5\u8bc6\u70b9 (https:\/\/mushiming.com\/) \u7b2c4\u5f20\" title=\"linux\u91cd\u5b9a\u5411\u662f\u4ec0\u4e48\u610f\u601d_linux\u57fa\u7840\u77e5\u8bc6\u70b9 \u7b2c4\u5f20-\u7a46\u4e16\u660e\u535a\u5ba2\" ><\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\"># 1 alt + F1~F6 # 2 ulimit -n # 3 w<\/code><\/pre>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A04.1%20kill%EF%BC%9A%E8%B8%A2%E5%87%BA%E5%85%B6%E4%BB%96%E9%9D%9E%E6%B3%95%E7%99%BB%E5%BD%95Linux%E7%B3%BB%E7%BB%9F%E7%9A%84%E7%94%A8%E6%88%B7\"> 4.1 kill\uff1a\u8e22\u51fa\u5176\u4ed6\u975e\u6cd5\u767b\u5f55Linux\u7cfb\u7edf\u7684\u7528\u6237<\/h3>\n<p>sshd\u670d\u52a1\u662f\u63d0\u4f9b\u8fdc\u7a0b\u767b\u5f55Linux\u7684\u670d\u52a1<\/p>\n<p>\u5254\u9664\u7528\u6237\u7684\u672c\u8d28\u5c31\u662f\u6740\u6b7b\u8fdb\u7a0b<\/p>\n<p>\u5229\u7528<span style=\"color:#4da8ee;\"><strong>w<\/strong><\/span>\u67e5\u770b\u7ec8\u7aef\uff0c\u6839\u636e\u7528\u6237\u7684\u7ec8\u7aef\u6765\u627e\u5230\u5bf9\u5e94\u7684bash\u8fdb\u7a0b\uff0c\u7136\u540ekill\u8fd9\u4e2abash\u8fdb\u7a0b<\/p>\n<p><strong><span style=\"color:#4da8ee;\">ps aux | grep pts\/1 <\/span><\/strong>==\u300b\u8fc7\u6ee4\u627e\u5230\u5bf9\u5e94\u8fdb\u7a0b\u53f7<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost pts]# ps aux | grep pts\/1 root 3090 0.0 0.3 6120 ? Ss 13:46 0:00 sshd: root@pts\/1 root 3098 0.0 0.1 2076 pts\/1 Ss+ 13:46 0:00 -bash root 14343 0.0 0.0 980 pts\/0 S+ 21:01 0:00 grep --color=auto pts\/1 [root@localhost pts]# kill -9 3098 [root@localhost pts]# w 21:05:31 up 8:17, 2 users, load average: 0.00, 0.01, 0.05 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root tty1 12:48 7:29m 0.05s 0.05s -bash root pts\/0 192.168.255.1 12:48 3.00s 0.06s 0.01s w <\/code><\/pre>\n<p><span style=\"color:#4da8ee;\"><strong>kill<\/strong><\/span> \u662fLinux\u6740\u6b7b\u8fdb\u7a0b\u7684\u547d\u4ee4<\/p>\n<p><span style=\"color:#4da8ee;\"><strong>-9 <\/strong><\/span>\u662f\u53d1\u9001\u5f3a\u5236\u6740\u6b7b\u8fdb\u7a0b\u7684\u4fe1\u53f7\uff0c\u544a\u8bc9Linux\u5185\u6838\u5f3a\u5236\u6740\u6b7b\u8fdb\u7a0b<\/p>\n<p><span style=\"color:#4da8ee;\"><strong>\u4fe1\u53f7<\/strong><\/span> \u662f\u8fdb\u7a0b\u548c\u8fdb\u7a0b\u4e4b\u95f4\u901a\u4fe1\u7684\u65b9\u5f0f<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\"># \u67e5\u770bLinux\u91cc\u6709\u54ea\u4e9b\u4fe1\u53f7\u95ee\u9898 [root@localhost pts]# kill -l <\/code><\/pre>\n<p><strong>9) SIGKILL signal kill<\/strong> \u6740\u6b7b\u8fdb\u7a0b\u7684\u4fe1\u53f7\uff0c\u5f3a\u5236\u6740\u6b7b\uff0c\u5fc5\u5b9a\u4f1a\u6740\u6b7b\u8fdb\u7a0b<\/p>\n<p><strong>15) SIGTERM signal terminate <\/strong>\u7ec8\u7ed3\u4fe1\u53f7\uff1a\u8ba9\u8fdb\u7a0b\u81ea\u5df1\u6740\u6b7b\u81ea\u5df1\uff0c\u53ef\u80fd\u6709\u7684\u8fdb\u7a0b\u4f1a\u4e0d\u6267\u884c<\/p>\n<p>\uff08\u4e0d\u63a5-9\uff0c\u9ed8\u8ba4\u662f-15\uff09<\/p>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A04.2%20ssh%E8%BF%9C%E7%A8%8B%E7%99%BB%E5%BD%95\"> 4.2 ssh\u8fdc\u7a0b\u767b\u5f55<\/h3>\n<p>ssh \u662f\u8fdc\u7a0b\u767b\u5f55\u7684\u547d\u4ee4<\/p>\n<pre class=\"language-java prettyprint linenums\"><code>ssh IP\u5730\u5740 ==\u300bLinux\u91cc\u4f7f\u7528ssh\u547d\u4ee4\u8fdc\u7a0b\u767b\u5f55\u5230\u5176\u4ed6\u673a\u5668\u91cc<\/code><\/pre>\n<h2 id=\"%E4%BA%94%E3%80%81%E3%80%90%E4%BD%BF%E7%94%A8%E3%80%91%E9%87%8D%E5%AE%9A%E5%90%91\">\u4e94\u3001\u3010\u4f7f\u7528\u3011\u91cd\u5b9a\u5411<\/h2>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.1%20%E6%A0%87%E5%87%86%E6%AD%A3%E7%A1%AE%E8%BE%93%E5%87%BA%E9%87%8D%E5%AE%9A%E5%90%91%20%3E\"> 5.1 \u6807\u51c6\u6b63\u786e\u8f93\u51fa\u91cd\u5b9a\u5411 ><\/h3>\n<p>\u5c06\u6807\u51c6\u8f93\u51fa\u5230\u5c4f\u5e55\u4e0a\u7684\u5185\u5bb9\u91cd\u5b9a\u5411\u5230\u6587\u4ef6\u91cc\uff0c\u5982\u679c\u6587\u4ef6\u4e0d\u5b58\u5728\u5c31\u4f1a\u81ea\u52a8\u65b0\u5efa\uff0c\u5982\u679c\u6587\u4ef6\u5b58\u5728\u5c31<strong>\u8986\u76d6<\/strong>\u91cc\u9762\u7684\u5185\u5bb9\u3002<\/p>\n<p>> \u548c 1> \u662f\u7b49\u4ef7\u7684<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\"> [root@localhost lianxi]# echo 1342 > 1.txt [root@localhost lianxi]# cat 1.txt 1342 [root@localhost lianxi]# echo dsfho 1> 1.txt [root@localhost lianxi]# cat 1.txt dsfho <\/code><\/pre>\n<p>\u4e0d\u540c\u7528\u6237\u4e4b\u95f4\u4f7f\u7528\u91cd\u5b9a\u5411\u6c9f\u901a\u4ea4\u6d41<\/p>\n<p>\u6838\u5fc3\uff1a\u5f80\u5bf9\u65b9\u7684\u6807\u51c6\u8f93\u51fa\u7684\u6587\u4ef6\u91cc\u91cd\u5b9a\u5411\uff0c\u5c31\u4f1a\u51fa\u73b0\u5728\u5bf9\u65b9\u7684\u5c4f\u5e55\u4e0a<\/p>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.2%20%E6%A0%87%E5%87%86%E8%BE%93%E5%87%BA%E8%BF%BD%E5%8A%A0%E9%87%8D%E5%AE%9A%E5%90%91%20%3E%3E\"> 5.2 \u6807\u51c6\u8f93\u51fa\u8ffd\u52a0\u91cd\u5b9a\u5411 >><\/h3>\n<p>\u5c06\u6807\u51c6\u8f93\u51fa\u5230\u5c4f\u5e55\u4e0a\u7684\u5185\u5bb9\u8ffd\u52a0\u91cd\u5b9a\u5411\u5230\u6587\u4ef6\u91cc\uff0c\u5982\u679c\u6587\u4ef6\u4e0d\u5b58\u5728\u5c31\u4f1a\u81ea\u52a8\u65b0\u5efa\uff0c\u5982\u679c\u6587\u4ef6\u5b58\u5728\u5c31\u4e0d\u8986\u76d6\u91cc\u9762\u7684\u5185\u5bb9\uff0c\u53ea\u662f\u5728\u672b\u5c3e<strong>\u8ffd\u52a0<\/strong>\u3002<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost lianxi]# cat 1.txt dsfho [root@localhost lianxi]# ls >> 1.txt [root@localhost lianxi]# cat 1.txt dsfho 1.txt backup_pwd_boot_log.sh backup_pwd.sh create_dir_v2.sh messages mkdir_file.sh passwd python-test sanchuang student.txt <\/code><\/pre>\n<p><span style=\"color:#956fe7;\"><strong>\u4efb\u4f55\u6709\u8f93\u51fa\u7684\u547d\u4ee4\u90fd\u53ef\u4ee5\u91cd\u5b9a\u5411<\/strong><\/span><\/p>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.2.1%20%E5%A4%8D%E5%88%B6%E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9%E7%B2%98%E8%B4%B4%E5%88%B0%E5%8F%A6%E4%B8%80%E4%B8%AA%E6%96%87%E4%BB%B6\"> 5.2.1 \u590d\u5236\u6587\u4ef6\u5185\u5bb9\u7c98\u8d34\u5230\u53e6\u4e00\u4e2a\u6587\u4ef6<\/h4>\n<p> \u3010\u793a\u4f8b\u3011\u4e0d\u4f7f\u7528cp\u547d\u4ee4\u5c06lihua.txt\u91cc\u7684\u5185\u5bb9\u590d\u5236\u5230lihong.txt\u91cc<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost lianxi]# cat lihua.txt lihua [root@localhost lianxi]# cat lihua.txt > lihong.txt [root@localhost lianxi]# cat lihong.txt lihua <\/code><\/pre>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.2.2%20%E5%90%88%E5%B9%B6%E4%B8%A4%E4%B8%AA%E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9\"> 5.2.2 \u5408\u5e76\u4e24\u4e2a\u6587\u4ef6\u5185\u5bb9<\/h4>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost lianxi]# cat lihua.txt lihua [root@localhost lianxi]# cat lihong.txt lihong [root@localhost lianxi]# cat lihua.txt lihong.txt > huahong.txt [root@localhost lianxi]# cat huahong.txt lihua lihong <\/code><\/pre>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.3%20%E6%A0%87%E5%87%86%E9%94%99%E8%AF%AF%E8%BE%93%E5%87%BA%E9%87%8D%E5%AE%9A%E5%90%91%202%3E\"> 5.3 \u6807\u51c6\u9519\u8bef\u8f93\u51fa\u91cd\u5b9a\u5411 2><\/h3>\n<p><strong>2><\/strong> \u5c06\u6807\u51c6<strong>\u9519\u8bef<\/strong>\u8f93\u51fa\u5230\u5c4f\u5e55\u4e0a\u7684\u5185\u5bb9\u91cd\u5b9a\u5411\u5230\u6587\u4ef6\u91cc\uff0c\u5982\u679c\u6587\u4ef6\u4e0d\u5b58\u5728\u5c31\u4f1a\u81ea\u52a8\u65b0\u5efa\uff0c\u5982\u679c\u6587\u4ef6\u5b58\u5728\u5c31<strong>\u8986\u76d6<\/strong>\u91cc\u9762\u7684\u5185\u5bb9\u3002<\/p>\n<p><strong>2>> <\/strong>\u5c06\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u5230\u5c4f\u5e55\u4e0a\u7684\u5185\u5bb9<strong>\u8ffd\u52a0<\/strong>\u91cd\u5b9a\u5411\u5230\u6587\u4ef6\u91cc\uff0c\u5982\u679c\u6587\u4ef6\u4e0d\u5b58\u5728\u5c31\u4f1a\u81ea\u52a8\u65b0\u5efa\uff0c\u5982\u679c\u6587\u4ef6\u5b58\u5728\u5c31\u4e0d\u8986\u76d6\u91cc\u9762\u7684\u5185\u5bb9\uff0c\u53ea\u662f\u5728\u672b\u5c3e<strong>\u8ffd\u52a0<\/strong>\u3002<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost lianxi]# sakdfhsai -bash: sakdfhsai: \u672a\u627e\u5230\u547d\u4ee4 [root@localhost lianxi]# sakdfhsai 2>2.txt [root@localhost lianxi]# cat 2.txt -bash: sakdfhsai: \u672a\u627e\u5230\u547d\u4ee4 [root@localhost lianxi]# kkkkkkkk -bash: kkkkkkkk: \u672a\u627e\u5230\u547d\u4ee4 [root@localhost lianxi]# kkkkkkkk 2>>2.txt [root@localhost lianxi]# cat 2.txt -bash: sakdfhsai: \u672a\u627e\u5230\u547d\u4ee4 -bash: kkkkkkkk: \u672a\u627e\u5230\u547d\u4ee4 <\/code><\/pre>\n<p>\u53ea\u4f1a\u91cd\u5b9a\u5411\u9519\u8bef\u7684\u8f93\u51fa\uff0c\u5982\u679c\u5c06\u6b63\u786e\u8f93\u51fa\u4f7f\u75282>\uff0c\u90a3\u5c31\u4f1a\u6e05\u7a7a\u6587\u4ef6<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost lianxi]# cat 2.txt -bash: sakdfhsai: \u672a\u627e\u5230\u547d\u4ee4 -bash: kkkkkkkk: \u672a\u627e\u5230\u547d\u4ee4 [root@localhost lianxi]# echo 132 2> 2.txt 132 [root@localhost lianxi]# cat 2.txt [root@localhost lianxi]# <\/code><\/pre>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.4%20%E5%90%8C%E6%97%B6%E4%BD%BF%E7%94%A81%3E%E5%92%8C2%3E\"> 5.4 \u540c\u65f6\u4f7f\u75281>\u548c2><\/h3>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost lianxi]# cat 1.txt [root@localhost lianxi]# cat 2.txt [root@localhost lianxi]# echo 1234 1>1.txt 2>2.txt ==\u300b\u5206\u6d41\uff1a\u6b63\u786e\u7684\u8f93\u51fa\u52301.txt\uff0c\u9519\u8bef\u7684\u8f93\u51fa\u52302.txt(\u4f1a\u6e05\u7a7a) [root@localhost lianxi]# cat 1.txt 1234 [root@localhost lianxi]# cat 2.txt [root@localhost lianxi]# echo1234 1>1.txt 2>2.txt [root@localhost lianxi]# cat 1.txt [root@localhost lianxi]# cat 2.txt -bash: echo1234: \u672a\u627e\u5230\u547d\u4ee4 <\/code><\/pre>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.5%20%E6%B8%85%E7%A9%BA%E6%96%87%E4%BB%B6%E4%BD%86%E4%B8%8D%E5%88%A0%E9%99%A4\"> 5.5 \u6e05\u7a7a\u6587\u4ef6\u4f46\u4e0d\u5220\u9664<\/h3>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost lianxi]# cat huahong.txt lihua lihong [root@localhost lianxi]# >huahong.txt [root@localhost lianxi]# cat huahong.txt [root@localhost lianxi]# <\/code><\/pre>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.6%20%E6%AD%A3%E7%A1%AE%E5%92%8C%E9%94%99%E8%AF%AF%E8%BE%93%E5%87%BA%E9%87%8D%E5%AE%9A%E5%90%91\"> 5.6 \u6b63\u786e\u548c\u9519\u8bef\u8f93\u51fa\u91cd\u5b9a\u5411<\/h3>\n<p><strong>&><\/strong> \u6b63\u786e\u7684\u548c\u9519\u8bef\u7684\u90fd\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u6587\u4ef6\u91cc\uff0c\u5982\u679c\u6587\u4ef6\u4e0d\u5b58\u5728\u5c31\u65b0\u5efa\uff0c\u5982\u679c\u5b58\u5728\u5c31\u8986\u76d6\u91cc\u9762\u7684\u5185\u5bb9\u3002<\/p>\n<p><strong>&>> <\/strong>\u6b63\u786e\u7684\u548c\u9519\u8bef\u7684\u90fd\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u6587\u4ef6\u91cc\uff0c\u5982\u679c\u6587\u4ef6\u4e0d\u5b58\u5728\u5c31\u65b0\u5efa\uff0c\u5982\u679c\u5b58\u5728\u5c31\u4e0d\u8986\u76d6\u91cc\u9762\u7684\u5185\u5bb9\uff0c\u53ea\u662f\u5728\u672b\u5c3e\u8ffd\u52a0\u3002<\/p>\n<p><span style=\"color:#4da8ee;\"><strong>echo feng >feng.txt 2>&1<\/strong><\/span> <==> <strong><span style=\"color:#4da8ee;\">echo feng &>feng.txt<\/span><\/strong> \u4e24\u79cd\u65b9\u6cd5\u7b49\u4ef7<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost lianxi]# cat feng.txt [root@localhost lianxi]# echo feng >feng.txt 2>&1 [root@localhost lianxi]# cat feng.txt feng <\/code><\/pre>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.7%20%E6%A0%87%E5%87%86%E7%9A%84%E8%BE%93%E5%85%A5%E9%87%8D%E5%AE%9A%E5%90%91\"> 5.7 \u6807\u51c6\u7684\u8f93\u5165\u91cd\u5b9a\u5411<\/h3>\n<p>\u4ece\u6587\u4ef6\u91cc\u5bfc\u5165\u5185\u5bb9\u7ed9\u7a0b\u5e8f<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost lianxi]# wc \/etc\/passwd 33 43 1487 \/etc\/passwd [root@localhost lianxi]# wc < \/etc\/passwd 33 43 1487 [root@localhost lianxi]# cat > feng.txt << EOF > FENGZHENGTING > FANMINGYOU > EOF ==>\u7ed3\u675f\u7684\u529f\u80fd<\/code><\/pre>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.8%20here%20document%EF%BC%88%E5%8D%B3\"> 5.8 here document\uff08\u5373<\/h3>\n<p>\u6587\u6863\u5c31\u5728\u8fd9\u91cc\uff0c\u7528\u4e8e\u751f\u6210\u4e00\u4e2a\u6307\u5b9a\u5185\u5bb9\u7684\u6587\u6863<\/p>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.8.1%20%E5%B0%86%E9%94%AE%E7%9B%98%E8%BE%93%E5%85%A5%E7%9A%84%E5%86%85%E5%AE%B9%E9%87%8D%E5%AE%9A%E5%90%91%E5%88%B0%E4%B8%80%E4%B8%AA%E6%96%87%E4%BB%B6%E9%87%8C\"> 5.8.1 \u5c06\u952e\u76d8\u8f93\u5165\u7684\u5185\u5bb9\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u6587\u4ef6\u91cc<\/h4>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost lianxi]# cat >abc.txt <<EOF \u63a5\u53d7\u952e\u76d8\u8f93\u5165\uff0c\u8f93\u5165\u5185\u5bb9\u91cd\u5b9a\u5411\u5230abc.txt\u6587\u4ef6\u91cc\uff0c\u9047\u5230EOF\u505c\u6b62\u8f93\u5165 > FENG > FAN > linux > end > eof > EOF [root@localhost lianxi]# cat abc.txt FENG FAN linux end eof <\/code><\/pre>\n<p><strong>EOF<\/strong> \u7ed3\u675f\u6807\u5fd7 end of file \u6587\u4ef6\u5230\u8fd9\u91cc\u7ed3\u675f\uff08\u7ed3\u675f\u6807\u5fd7\u53ef\u4ee5\u662f\u5176\u4ed6\u7684\u5b57\u7b26\u4e32\uff0c\u5efa\u8bae\u4f7f\u7528EOF\u6216end\uff09<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost lianxi]# cat >lihua.txt <<end > lihua > linux > EOF > END > end [root@localhost lianxi]# cat lihua.txt lihua linux EOF END <\/code><\/pre>\n<h4 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.8.2%20%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA%E6%8C%87%E5%AE%9A%E5%86%85%E5%AE%B9%E7%9A%84%E6%96%87%E4%BB%B6\"> 5.8.2 \u751f\u6210\u4e00\u4e2a\u6307\u5b9a\u5185\u5bb9\u7684\u6587\u4ef6<\/h4>\n<p>\u7528\u4e8e\uff1a\u751f\u6210\u4e00\u4e2a\u6307\u5b9a\u5185\u5bb9\u914d\u7f6e\u6587\u4ef6\uff0c\u914d\u7f6e\u6587\u4ef6\u91cc\u7684\u5185\u5bb9\u662f\u6211\u4eec\u63d0\u524d\u51c6\u5907\u597d\u7684<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost lianxi]# cd 0323 [root@localhost 0323]# ls [root@localhost 0323]# vim li_feng_fan.sh [root@localhost 0323]# cat li_feng_fan.sh #!\/bin\/bash #lihua cat >> \/root\/lianxi\/0323\/li_feng_fan.txt <<EOF lihua changsha fengxiaojie xiangtan fanxiansheng chengzhou EOF echo \"#########################\" cat \/root\/lianxi\/0323\/li_feng_fan.txt echo \"#########################\" [root@localhost 0323]# bash li_feng_fan.sh ######################### lihua changsha fengxiaojie xiangtan fanxiansheng chengzhou ######################### [root@localhost 0323]# ls li_feng_fan.sh li_feng_fan.txt <\/code><\/pre>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A05.9%20tee\"> 5.9 tee<\/h3>\n<p>\u5c06\u5185\u5bb9\u91cd\u5b9a\u5411\u5230\u6587\u4ef6\uff0c\u540c\u65f6\u5728\u5c4f\u5e55\u4e0a\u8f93\u51fa<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost 0324]# echo lihua | tee lihua.txt lihua [root@localhost 0324]# cat lihua.txt lihua <\/code><\/pre>\n<h2 id=\"%E5%85%AD%E3%80%81%E8%AE%BE%E5%A4%87%E6%96%87%E4%BB%B6\">\u516d\u3001\u8bbe\u5907\u6587\u4ef6<\/h2>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A06.1%20%2Fdev%2Fnull\"> 6.1 \/dev\/null<\/h3>\n<p><strong>\/dev\/null<\/strong> \u9ed1\u6d1e\u6587\u4ef6\uff1a\u846b\u82a6\u6587\u4ef6\uff0c\u4efb\u4f55\u5185\u5bb9\u91cd\u5b9a\u5411\u5230\u8fd9\u4e2a\u6587\u4ef6\uff0c\u90fd\u4f1a\u6d88\u5931\uff0c\u4e0d\u4fdd\u5b58<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost ~]# du -sh \/ du: \u65e0\u6cd5\u8bbf\u95ee\"\/proc\/18232\/task\/18232\/fd\/4\": \u6ca1\u6709\u90a3\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55 du: \u65e0\u6cd5\u8bbf\u95ee\"\/proc\/18232\/task\/18232\/fdinfo\/4\": \u6ca1\u6709\u90a3\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55 du: \u65e0\u6cd5\u8bbf\u95ee\"\/proc\/18232\/fd\/3\": \u6ca1\u6709\u90a3\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55 du: \u65e0\u6cd5\u8bbf\u95ee\"\/proc\/18232\/fdinfo\/3\": \u6ca1\u6709\u90a3\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55 2.0G \/ [root@localhost ~]# du -sh \/ 2>\/dev\/null 2.0G \/ <\/code><\/pre>\n<h3 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A06.2%20%2Fdev%2Fzero\"> 6.2 \/dev\/zero<\/h3>\n<p>\u96f6\u4ea7\u751f\u5668\uff1a\u80fd\u4ea7\u751f\u4e00\u58060\u7684\u6587\u4ef6<\/p>\n<p><span style=\"color:#956fe7;\"><strong>dd <\/strong><\/span>\u662f\u4e00\u4e2a\u5907\u4efd\u547d\u4ee4\uff0c\u4e5f\u53ef\u4ee5\u4ea7\u751f\u4e00\u4e2a\u6307\u5b9a\u5927\u5c0f\u7684\u6587\u4ef6<\/p>\n<p><span style=\"color:#956fe7;\"><strong>if<\/strong><\/span> \u8f93\u5165\u8bbe\u5907\u6587\u4ef6 input file<\/p>\n<p><span style=\"color:#956fe7;\"><strong>of <\/strong><\/span>\u8f93\u51fa\u6587\u4ef6 output file<\/p>\n<p><span style=\"color:#956fe7;\"><strong>bs<\/strong><\/span> \u5355\u4f4d\u65f6\u95f4\u91cc\u8bfb\u5199\u7684\u6570\u636e\u7684\u5b57\u8282\u6570\uff1a\u8f93\u51fa\u7684\u6570\u636e\u7684\u5355\u4f4d\u5927\u5c0f<\/p>\n<p><span style=\"color:#956fe7;\"><strong>count<\/strong><\/span> \u8f93\u51fa\u6570\u636e\u7684\u6570\u91cf<\/p>\n<p>\u3010dd\u4e5f\u53ef\u4ee5\u7528\u6765\u6d4b\u8bd5\u78c1\u76d8\u7684\u8bfb\u5199\u901f\u5ea6\u3011<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost ~]# dd if=\/dev\/zero of=\/root\/lianxi\/test.dd bs=1M count=100 \u8bb0\u5f55\u4e86100+0 \u7684\u8bfb\u5165 \u8bb0\u5f55\u4e86100+0 \u7684\u5199\u51fa \u5b57\u8282(105 MB)\u5df2\u590d\u5236\uff0c0.0 \u79d2\uff0c3.3 GB\/\u79d2 [root@localhost lianxi]# du -sh test.dd 100M test.dd <\/code><\/pre>\n<h2 id=\"%E4%B8%83%E3%80%81read%E9%9A%90%E8%97%8F%E8%BE%93%E5%85%A5%E7%9A%84%E5%AF%86%E7%A0%81\">\u4e03\u3001read\u9690\u85cf\u8f93\u5165\u7684\u5bc6\u7801<\/h2>\n<p>\u4f7f\u7528<span style=\"color:#fe2c24;\"><strong> -s<\/strong><\/span> \u9009\u9879<\/p>\n<p>\u4e0d\u53ef\u4ee5\u653e\u5728-p \u548c\u63d0\u793a\u4e4b\u95f4\uff0c\u90a3\u6837\u4f1a\u6253\u65ad-p\u7684\u529f\u80fd<\/p>\n<pre class=\"language-java prettyprint linenums\"><code class=\"language-bash\">[root@localhost 0324]# vim create_user.sh [root@localhost 0324]# bash create_user.sh \u8bf7\u8f93\u5165\u4f60\u7684\u7528\u6237\u540d\uff1alihua \u8bf7\u8f93\u5165\u4f60\u7684\u5bc6\u7801\uff1a create user ok username is lihua and passwd is [root@localhost 0324]# cat create_user.sh #!\/bin\/bash # \u63a5\u53d7\u7528\u6237\u540d\u548c\u5bc6\u7801 read -p \"\u8bf7\u8f93\u5165\u4f60\u7684\u7528\u6237\u540d\uff1a\" u_name read -s -p \"\u8bf7\u8f93\u5165\u4f60\u7684\u5bc6\u7801\uff1a\" u_pwd echo # \u65b0\u5efa\u7528\u6237 useradd $u_name &> \/dev\/null # \u8bbe\u7f6e\u5bc6\u7801 echo $u_pwd | passwd $u_name --stdin &> \/dev\/null echo \"create user ok\" echo \"username is $u_name and passwd is $u_pwd\" <\/code><\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"linux\u91cd\u5b9a\u5411\u662f\u4ec0\u4e48\u610f\u601d_linux\u57fa\u7840\u77e5\u8bc6\u70b9\u76ee\u5f55\u4e00\u3001\u89e3\u91ca\u578b\u8bed\u8a00\u548c\u7f16\u8bd1\u578b\u8bed\u8a001.1python\u89e3\u91ca\u56681.2\u4e0b\u8f7d\u8f6f\u4ef61.2.1wget1.2.2curl1.2.3...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/5348"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=5348"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/5348\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=5348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=5348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=5348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}