{"id":113,"date":"2018-08-05T10:41:57","date_gmt":"2018-08-05T02:41:57","guid":{"rendered":"https:\/\/103.249.111.182\/?p=113"},"modified":"2018-08-05T10:41:57","modified_gmt":"2018-08-05T02:41:57","slug":"%e7%ac%94%e8%ae%b0linux%e5%9f%ba%e7%a1%80%e5%85%a5%e9%97%a8","status":"publish","type":"post","link":"https:\/\/7gugu.com\/index.php\/2018\/08\/05\/%e7%ac%94%e8%ae%b0linux%e5%9f%ba%e7%a1%80%e5%85%a5%e9%97%a8\/","title":{"rendered":"[\u7b14\u8bb0]Linux\u57fa\u7840\u5165\u95e8"},"content":{"rendered":"<div>\n<div>\n<h3>\u76ee\u5f55\u64cd\u4f5c<\/h3>\n<hr \/>\n<h4>\u521b\u5efa\u76ee\u5f55<\/h4>\n<div class=\"p\">\u4f7f\u7528 mkdir \u547d\u4ee4\u521b\u5efa\u76ee\u5f55<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>mkdir $HOME\/testFolder<\/pre>\n<\/div>\n<div>\n<p>(home\u662f\u7528\u6237\u5730\u4e3b\u76ee\u5f55\uff0c\u767b\u5f55\u540e\u7f3a\u7701\u8fdb\u5165\u7684\u76ee\u5f55\uff0c\u6bd4\u65b9\u8bf4\u6709\u4e2a\u7528\u6237\u53ebwang\uff0c\u90a3\u4ed6\u7684\u5730\u4e3b\u76ee\u5f55\u5c31\u662f\/home\/wang\uff0c\u4e5f\u80fd\u591f\u7528~wang\u8868\u793a\u3002\u5176\u5b9e\u5982\u679c\u5728\u5b89\u88c5Linux\u65f6\u9009\u62e9\u4e2d\u6587\u7248\uff0c\u684c\u9762\u7684\u76ee\u5f55\u5c31\u5728$home\u76ee\u5f55\u4e0b\u7684\u201c\u684c\u9762\u76ee\u5f55\u201d\u3002)<\/p>\n<hr \/>\n<h4>\u5207\u6362\u76ee\u5f55<\/h4>\n<div>\n<div>\n<div class=\"p\">\u4f7f\u7528 cd \u547d\u4ee4\u5207\u6362\u76ee\u5f55<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>cd $HOME\/testFolder<\/pre>\n<\/div>\n<\/div>\n<div>\n<div>\n<div class=\"p\">\u4f7f\u7528 cd ..\/ \u547d\u4ee4\u5207\u6362\u5230\u4e0a\u4e00\u7ea7\u76ee\u5f55<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>cd ..\/<\/pre>\n<hr \/>\n<h4>\u79fb\u52a8\u76ee\u5f55<\/h4>\n<div>\n<div>\n<div class=\"p\">\u4f7f\u7528 mv \u547d\u4ee4\u79fb\u52a8\u76ee\u5f55<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>mv $HOME\/testFolder \/var\/tmp<\/pre>\n<hr \/>\n<h4>\u5220\u9664\u76ee\u5f55<\/h4>\n<div>\n<div>\n<div class=\"p\">\u4f7f\u7528 rm -rf \u547d\u4ee4\u5220\u9664\u76ee\u5f55<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>rm -rf \/var\/tmp\/testFolder<\/pre>\n<hr \/>\n<h4>\u67e5\u770b\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6<\/h4>\n<div>\n<div>\n<div class=\"p\">\u4f7f\u7528 ls \u547d\u4ee4\u67e5\u770b<span class=\"bubble-text\">\/etc<\/span>\u76ee\u5f55\u4e0b\u6240\u6709\u6587\u4ef6\u548c\u6587\u4ef6\u5939<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo-bd\">\n<pre>ls \/etc<\/pre>\n<p>(\/etc \u76ee\u5f55\u9ed8\u8ba4\u662f *nix \u7cfb\u7edf\u7684\u8f6f\u4ef6\u914d\u7f6e\u6587\u4ef6\u5b58\u653e\u4f4d\u7f6e)<\/p>\n<\/div>\n<\/div>\n<hr \/>\n<h3>\u6587\u4ef6\u64cd\u4f5c<\/h3>\n<hr \/>\n<h4>\u521b\u5efa\u6587\u4ef6<\/h4>\n<div>\n<div>\n<div>\n<div>\n<div class=\"p\">\u4f7f\u7528 touch \u547d\u4ee4\u521b\u5efa\u6587\u4ef6<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>touch ~\/testFile<\/pre>\n<\/div>\n<div class=\"lab-bubble-icon tooltip\">\n<div class=\"p\">\u6267\u884c <code>ls<\/code> \u547d\u4ee4, \u53ef\u4ee5\u770b\u5230\u521a\u624d\u65b0\u5efa\u7684 testFile \u6587\u4ef6<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>ls ~<\/pre>\n<hr \/>\n<h4>\u590d\u5236\u6587\u4ef6<\/h4>\n<div>\n<div>\n<div class=\"p\">\u4f7f\u7528 cp \u547d\u4ee4\u590d\u5236\u6587\u4ef6<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>cp ~\/testFile ~\/testNewFile<\/pre>\n<hr \/>\n<h4>\u5220\u9664\u6587\u4ef6<\/h4>\n<div>\n<div>\n<div class=\"p\">\u4f7f\u7528 rm \u547d\u4ee4\u5220\u9664\u6587\u4ef6, \u8f93\u5165 <code>y<\/code> \u540e\u56de\u8f66\u786e\u8ba4\u5220\u9664<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>rm ~\/testFile<\/pre>\n<hr \/>\n<h4>\u67e5\u770b\u6587\u4ef6\u5185\u5bb9<\/h4>\n<div>\n<div>\n<div class=\"p\">\u4f7f\u7528 cat \u547d\u4ee4\u67e5\u770b .bash_history \u6587\u4ef6\u5185\u5bb9<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>cat ~\/.bash_history<\/pre>\n<hr \/>\n<h3>\u8fc7\u6ee4,\u7ba1\u9053\u4e0e\u91cd\u5b9a\u5411<\/h3>\n<hr \/>\n<h4>\u8fc7\u6ee4<\/h4>\n<div>\n<div>\n<div class=\"p\">\u8fc7\u6ee4\u51fa \/etc\/passwd \u6587\u4ef6\u4e2d\u5305\u542b <code>root<\/code> \u7684\u8bb0\u5f55<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>grep 'root' \/etc\/passwd<\/pre>\n<\/div>\n<div class=\"p\">\u9012\u5f52\u5730\u8fc7\u6ee4\u51fa \/var\/log\/ \u76ee\u5f55\u4e2d\u5305\u542b <code>linux<\/code> \u7684\u8bb0\u5f55<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>grep -r 'linux' \/var\/log\/<\/pre>\n<hr \/>\n<h4>\u7ba1\u9053<\/h4>\n<div>\n<div>\n<div class=\"p\">\u7b80\u5355\u6765\u8bf4, Linux \u4e2d\u7ba1\u9053\u7684\u4f5c\u7528\u662f\u5c06\u4e0a\u4e00\u4e2a\u547d\u4ee4\u7684\u8f93\u51fa\u4f5c\u4e3a\u4e0b\u4e00\u4e2a\u547d\u4ee4\u7684\u8f93\u5165, \u50cf pipe \u4e00\u6837\u5c06\u5404\u4e2a\u547d\u4ee4\u4e32\u8054\u8d77\u6765\u6267\u884c, \u7ba1\u9053\u7684\u64cd\u4f5c\u7b26\u662f |<\/div>\n<\/div>\n<\/div>\n<div>\n<div>\n<div class=\"p\">\u6bd4\u5982, \u6211\u4eec\u53ef\u4ee5\u5c06 cat \u548c grep \u4e24\u4e2a\u547d\u4ee4\u7528\u7ba1\u9053\u7ec4\u5408\u5728\u4e00\u8d77<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>cat \/etc\/passwd | grep 'root'<\/pre>\n<\/div>\n<div class=\"p\">\u8fc7\u6ee4\u51fa \/etc \u76ee\u5f55\u4e2d\u540d\u5b57\u5305\u542b <code>ssh<\/code> \u7684\u76ee\u5f55(\u4e0d\u5305\u62ec\u5b50\u76ee\u5f55)<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>ls \/etc | grep 'ssh'<\/pre>\n<hr \/>\n<h4>\u91cd\u5b9a\u5411<\/h4>\n<div>\n<div>\n<div class=\"p\">\u53ef\u4ee5\u4f7f\u7528 &gt; \u6216 &lt; \u5c06\u547d\u4ee4\u7684\u8f93\u51fa\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u6587\u4ef6\u4e2d<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>echo 'Hello World' &amp;gt; ~\/test.txt<\/pre>\n<hr \/>\n<h3>\u5e38\u7528\u8fd0\u7ef4\u6307\u4ee4<\/h3>\n<hr \/>\n<h4>Ping\u6307\u4ee4<\/h4>\n<div>\n<div>\n<div class=\"p\">\u5bf9 cloud.tencent.com \u53d1\u9001 4 \u4e2a ping \u5305, \u68c0\u67e5\u4e0e\u5176\u662f\u5426\u8054\u901a<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>ping -c 4 cloud.tencent.com<\/pre>\n<hr \/>\n<h4>Netstat\u6307\u4ee4<\/h4>\n<div>\n<div>\n<div class=\"p\">netstat \u547d\u4ee4\u7528\u4e8e\u663e\u793a\u5404\u79cd\u7f51\u7edc\u76f8\u5173\u4fe1\u606f\uff0c\u5982\u7f51\u7edc\u8fde\u63a5, \u8def\u7531\u8868, \u63a5\u53e3\u72b6\u6001\u7b49\u7b49<\/div>\n<\/div>\n<\/div>\n<div>\n<div>\n<div class=\"p\">\u5217\u51fa\u6240\u6709\u5904\u4e8e\u76d1\u542c\u72b6\u6001\u7684tcp\u7aef\u53e3<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>netstat -lt<\/pre>\n<\/div>\n<\/div>\n<div>\n<div>\n<div class=\"p\">\u67e5\u770b\u6240\u6709\u7684\u7aef\u53e3\u4fe1\u606f, \u5305\u62ec PID \u548c\u8fdb\u7a0b\u540d\u79f0<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>netstat -tulpn<\/pre>\n<hr \/>\n<h4>Ps\u6307\u4ee4<\/h4>\n<div>\n<div>\n<div class=\"p\">\u8fc7\u6ee4\u5f97\u5230\u5f53\u524d\u7cfb\u7edf\u4e2d\u7684 ssh \u8fdb\u7a0b\u4fe1\u606f<\/div>\n<\/div>\n<\/div>\n<div class=\"lab-coding-demo open\">\n<div class=\"lab-coding-demo-bd\">\n<pre>ps -aux | grep 'ssh'<\/pre>\n<hr \/>\n<h5>\u8d44\u6599\u6765\u6e90:<\/h5>\n<p><a href=\"http:\/\/cloud.tencent.com\">\u817e\u8baf\u4e91<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55\u64cd\u4f5c \u521b\u5efa\u76ee\u5f55 \u4f7f\u7528 mkdir \u547d\u4ee4\u521b\u5efa\u76ee\u5f55 mkdir $HOME\/testFolder (home\u662f &hellip; <a href=\"https:\/\/7gugu.com\/index.php\/2018\/08\/05\/%e7%ac%94%e8%ae%b0linux%e5%9f%ba%e7%a1%80%e5%85%a5%e9%97%a8\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c[\u7b14\u8bb0]Linux\u57fa\u7840\u5165\u95e8\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,13],"tags":[],"class_list":["post-113","post","type-post","status-publish","format-standard","hentry","category-codetype","category-13"],"_links":{"self":[{"href":"https:\/\/7gugu.com\/index.php\/wp-json\/wp\/v2\/posts\/113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/7gugu.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/7gugu.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/7gugu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/7gugu.com\/index.php\/wp-json\/wp\/v2\/comments?post=113"}],"version-history":[{"count":0,"href":"https:\/\/7gugu.com\/index.php\/wp-json\/wp\/v2\/posts\/113\/revisions"}],"wp:attachment":[{"href":"https:\/\/7gugu.com\/index.php\/wp-json\/wp\/v2\/media?parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/7gugu.com\/index.php\/wp-json\/wp\/v2\/categories?post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/7gugu.com\/index.php\/wp-json\/wp\/v2\/tags?post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}