{"id":72512,"date":"2026-02-05T20:49:19","date_gmt":"2026-02-05T12:49:19","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/72512.html"},"modified":"2026-02-05T20:49:19","modified_gmt":"2026-02-05T12:49:19","slug":"%e5%b5%8c%e5%85%a5%e5%bc%8flinux%e5%bc%80%e5%8f%91%e5%bf%85%e5%ad%a6shell-%e4%bb%8e%e5%9f%ba%e7%a1%80%e5%91%bd%e4%bb%a4%e5%88%b0%e8%84%9a%e6%9c%ac%e8%87%aa%e5%8a%a8%e5%8c%96","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/72512.html","title":{"rendered":"\u5d4c\u5165\u5f0fLinux\u5f00\u53d1\u5fc5\u5b66Shell \u4ece\u57fa\u7840\u547d\u4ee4\u5230\u811a\u672c\u81ea\u52a8\u5316"},"content":{"rendered":"<h3 style=\"background-color:transparent\">\u4e00\u3001Shell \u672c\u8d28 \u4eba\u673a\u5bf9\u8bdd\u7684\u201c\u7ffb\u8bd1\u5b98\u201d<\/h3>\n<p>\u5f53\u4f60\u9762\u5bf9\u4e00\u53f0\u5d4c\u5165\u5f0f Linux \u8bbe\u5907&#xff08;\u5982\u667a\u80fd\u97f3\u7bb1\u3001\u8def\u7531\u5668&#xff09;&#xff0c;\u5982\u4f55\u8ba9\u5b83\u6267\u884c\u4f60\u7684\u6307\u4ee4&#xff1f;Shell \u5c31\u662f\u8fd9\u4e2a\u201c\u5bf9\u8bdd\u7ffb\u8bd1\u5b98\u201d\u3002\u5b83\u63a5\u6536\u4f60\u7684\u6587\u672c\u547d\u4ee4&#xff0c;\u7ffb\u8bd1\u6210\u5185\u6838\u80fd\u7406\u89e3\u7684\u8bed\u8a00&#xff0c;\u518d\u5c06\u7ed3\u679c\u8fd4\u56de\u7ed9\u4f60\u3002\u7ec8\u7aef\u7a97\u53e3\u5c31\u662f\u4f60\u4e0e Shell \u4ea4\u4e92\u7684\u754c\u9762&#xff0c;\u800c Shell \u811a\u672c\u5219\u662f\u5c06\u591a\u4e2a\u547d\u4ee4\u7ec4\u5408\u6210\u81ea\u52a8\u5316\u7a0b\u5e8f\u7684\u5de5\u5177\u3002\u7406\u89e3\u8fd9\u4e00\u70b9&#xff0c;\u662f\u638c\u63e1 Linux \u547d\u4ee4\u884c\u7684\u7b2c\u4e00\u6b65\u3002<\/p>\n<h3>\u4e8c\u3001\u57fa\u7840\u547d\u4ee4 \u50cf\u624b\u673a\u64cd\u4f5c\u4e00\u6837\u76f4\u89c2<\/h3>\n<h4>1. \u6587\u4ef6\u4e0e\u76ee\u5f55\u64cd\u4f5c<\/h4>\n<h5>ls \u67e5\u770b\u5f53\u524d\u76ee\u5f55\u5185\u5bb9<\/h5>\n<p>ls           # \u7b80\u5355\u5217\u51fa<br \/>\nls -l        # \u8be6\u7ec6\u5217\u8868&#xff08;\u6743\u9650\u3001\u5927\u5c0f\u3001\u65f6\u95f4&#xff09;<br \/>\nls -la       # \u663e\u793a\u6240\u6709\u6587\u4ef6&#xff08;\u542b\u9690\u85cf\u6587\u4ef6&#xff09;<br \/>\nls -lh       # \u5927\u5c0f\u4ee5 K\/M\/G \u663e\u793a<\/p>\n<h5>cd \u5207\u6362\u76ee\u5f55<\/h5>\n<p>cd \/home\/user\/docs  # \u7edd\u5bf9\u8def\u5f84<br \/>\ncd ..               # \u8fd4\u56de\u4e0a\u7ea7\u76ee\u5f55<br \/>\ncd ~                # \u8fd4\u56de\u5bb6\u76ee\u5f55<br \/>\ncd &#8211;                # \u8fd4\u56de\u4e0a\u4e00\u6b21\u76ee\u5f55<\/p>\n<h5>mkdir\/rm \u521b\u5efa\u5220\u9664<\/h5>\n<p>mkdir project       # \u521b\u5efa\u6587\u4ef6\u5939<br \/>\nmkdir -p a\/b\/c      # \u9012\u5f52\u521b\u5efa\u591a\u7ea7\u76ee\u5f55<br \/>\nrm file.txt         # \u5220\u9664\u6587\u4ef6<br \/>\nrm -rf old_dir      # \u5f3a\u5236\u5220\u9664\u76ee\u5f55&#xff08;\u5371\u9669&#xff01;&#xff09;<\/p>\n<h4>2. \u6587\u4ef6\u5185\u5bb9\u67e5\u770b<\/h4>\n<h5>cat\/head\/tail \u4e0d\u540c\u7c92\u5ea6\u7684\u67e5\u770b<\/h5>\n<p>cat config.txt      # \u67e5\u770b\u6574\u4e2a\u6587\u4ef6<br \/>\ncat -n config.txt   # \u5e26\u884c\u53f7\u663e\u793a<br \/>\nhead -10 log.txt    # \u67e5\u770b\u524d10\u884c<br \/>\ntail -5 log.txt     # \u67e5\u770b\u540e5\u884c<br \/>\ntail -f app.log     # \u5b9e\u65f6\u8ddf\u8e2a\u65e5\u5fd7&#xff08;\u8c03\u8bd5\u795e\u5668&#xff09;<\/p>\n<h5>more\/less \u5206\u9875\u6d4f\u89c8<\/h5>\n<p>more long_file.txt  # \u5206\u9875\u67e5\u770b&#xff08;\u53ea\u80fd\u5411\u4e0b&#xff09;<br \/>\nless long_file.txt  # \u53ef\u4e0a\u4e0b\u7ffb\u9875\u3001\u641c\u7d22&#xff08;\/\u5173\u952e\u8bcd&#xff0c;n\/N \u4e0a\u4e0b\u67e5\u627e&#xff09;<\/p>\n<h3>\u4e09\u3001\u9ad8\u7ea7\u5de5\u5177 \u547d\u4ee4\u7ec4\u5408\u7684\u827a\u672f<\/h3>\n<h4>1. \u7ba1\u9053 | \u547d\u4ee4\u63a5\u529b<\/h4>\n<p>\u524d\u4e00\u4e2a\u547d\u4ee4\u7684\u8f93\u51fa\u4f5c\u4e3a\u540e\u4e00\u4e2a\u547d\u4ee4\u7684\u8f93\u5165&#xff1a;<\/p>\n<p>ls | grep &#034;.txt&#034;           # \u7b5b\u9009.txt\u6587\u4ef6<br \/>\nps aux | grep &#034;python&#034;     # \u67e5\u627epython\u8fdb\u7a0b<br \/>\ncat log.txt | wc -l        # \u7edf\u8ba1\u6587\u4ef6\u884c\u6570<\/p>\n<h4>2. \u91cd\u5b9a\u5411 \u63a7\u5236\u8f93\u5165\u8f93\u51fa\u6d41\u5411<\/h4>\n<p>ls &gt; files.txt       # \u8f93\u51fa\u91cd\u5b9a\u5411\u5230\u6587\u4ef6&#xff08;\u8986\u76d6&#xff09;<br \/>\nls &gt;&gt; files.txt      # \u8f93\u51fa\u8ffd\u52a0\u5230\u6587\u4ef6<br \/>\ngrep &#034;error&#034; &lt; log.txt  # \u4ece\u6587\u4ef6\u8bfb\u53d6\u8f93\u5165<br \/>\ncommand 2&gt; error.log  # \u9519\u8bef\u4fe1\u606f\u91cd\u5b9a\u5411<\/p>\n<h4>3. grep \u6587\u672c\u641c\u7d22\u795e\u5668<\/h4>\n<p>grep &#034;error&#034; app.log        # \u641c\u7d22\u5305\u542b&#034;error&#034;\u7684\u884c<br \/>\ngrep -n &#034;error&#034; app.log     # \u663e\u793a\u884c\u53f7<br \/>\ngrep -i &#034;ERROR&#034; app.log     # \u5ffd\u7565\u5927\u5c0f\u5199<br \/>\ngrep -r &#034;main&#034; .\/src\/       # \u9012\u5f52\u641c\u7d22\u76ee\u5f55<br \/>\ngrep -v &#034;debug&#034; app.log     # \u6392\u9664\u5305\u542b&#034;debug&#034;\u7684\u884c<\/p>\n<h4>4. \u901a\u914d\u7b26 \u6279\u91cf\u64cd\u4f5c<\/h4>\n<p>*.txt    # \u5339\u914d\u6240\u6709.txt\u6587\u4ef6<br \/>\ntest?.c  # \u5339\u914dtest1.c, test2.c\u7b49<br \/>\n[0-9].log  # \u5339\u914d0.log\u52309.log<br \/>\n[a-c]*.txt  # \u5339\u914da,b,c\u5f00\u5934\u7684.txt\u6587\u4ef6<\/p>\n<h3>\u56db\u3001\u6743\u9650\u7ba1\u7406 \u6587\u4ef6\u5b89\u5168\u4e4b\u95e8<\/h3>\n<h4>1. \u6743\u9650\u57fa\u7840<\/h4>\n<ul>\n<li>\n<p>r(\u8bfb)&#061;4, w(\u5199)&#061;2, x(\u6267\u884c)&#061;1<\/p>\n<\/li>\n<li>\n<p>\u4e09\u7ec4\u6743\u9650&#xff1a;\u6240\u6709\u8005(u) \u6240\u5c5e\u7ec4(g) \u5176\u4ed6\u4eba(o)<\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b&#xff1a;rwxr-xr&#8211; &#061; 754 (7&#061;4&#043;2&#043;1, 5&#061;4&#043;1, 4&#061;4)<\/p>\n<\/li>\n<\/ul>\n<h4>2. chmod \u4fee\u6539\u6743\u9650<\/h4>\n<p># \u6570\u5b57\u8868\u793a\u6cd5<br \/>\nchmod 755 script.sh   # \u6240\u6709\u8005rwx&#xff0c;\u7ec4rx&#xff0c;\u5176\u4ed6\u4ebarx<br \/>\nchmod 644 config.ini  # \u6240\u6709\u8005rw&#xff0c;\u7ec4r&#xff0c;\u5176\u4ed6\u4ebar<\/p>\n<p># \u7b26\u53f7\u8868\u793a\u6cd5<br \/>\nchmod u&#043;x script.sh   # \u7ed9\u6240\u6709\u8005\u52a0\u6267\u884c\u6743\u9650<br \/>\nchmod g-w data.txt    # \u53bb\u6389\u7ec4\u7684\u5199\u6743\u9650<br \/>\nchmod o&#061;r readme.txt  # \u5176\u4ed6\u4eba\u53ea\u8bfb<\/p>\n<h4>3. \u6587\u4ef6\u5f52\u5c5e<\/h4>\n<p>chown user file.txt      # \u4fee\u6539\u6240\u6709\u8005<br \/>\nchown user:group file.txt  # \u540c\u65f6\u4fee\u6539\u6240\u6709\u8005\u548c\u7ec4<br \/>\nchgrp devs project\/      # \u4fee\u6539\u6240\u5c5e\u7ec4<\/p>\n<h3>\u4e94\u3001\u6587\u4ef6\u5904\u7406 \u538b\u7f29\u4e0e\u67e5\u627e<\/h3>\n<h4>1. tar \u6253\u5305\u538b\u7f29<\/h4>\n<p># \u538b\u7f29<br \/>\ntar -zcvf backup.tar.gz dir\/     # gzip\u538b\u7f29&#xff08;.tar.gz&#xff09;<br \/>\ntar -jcvf backup.tar.bz2 dir\/    # bzip2\u538b\u7f29&#xff08;.tar.bz2&#xff0c;\u538b\u7f29\u7387\u66f4\u9ad8&#xff09;<\/p>\n<p># \u89e3\u538b<br \/>\ntar -zxvf backup.tar.gz<br \/>\ntar -jxvf backup.tar.bz2 -C \/target\/  # \u89e3\u538b\u5230\u6307\u5b9a\u76ee\u5f55<\/p>\n<p># \u4ec5\u67e5\u770b<br \/>\ntar -ztvf backup.tar.gz  # \u67e5\u770b\u538b\u7f29\u5305\u5185\u5bb9<\/p>\n<h4>2. find \u7cbe\u51c6\u67e5\u627e<\/h4>\n<p>find \/home -name &#034;*.log&#034;         # \u6309\u540d\u79f0\u67e5\u627e<br \/>\nfind . -iname &#034;config*&#034;          # \u5ffd\u7565\u5927\u5c0f\u5199<br \/>\nfind .\/src -type f -name &#034;*.c&#034;   # \u53ea\u627e\u6587\u4ef6<br \/>\nfind \/var -size &#043;10M             # \u67e5\u627e\u5927\u4e8e10M\u7684\u6587\u4ef6<br \/>\nfind . -mtime -7                 # 7\u5929\u5185\u4fee\u6539\u7684\u6587\u4ef6<br \/>\nfind . -name &#034;*.tmp&#034; -exec rm {} \\\\;  # \u627e\u5230\u540e\u6267\u884c\u5220\u9664<\/p>\n<h3>\u516d\u3001Shell \u7f16\u7a0b \u81ea\u52a8\u5316\u811a\u672c<\/h3>\n<h4>1. \u53d8\u91cf<\/h4>\n<p>name&#061;&#034;Linux&#034;          # \u5b9a\u4e49\u53d8\u91cf<br \/>\necho &#034;Hello $name&#034;    # \u4f7f\u7528\u53d8\u91cf<br \/>\necho $HOME            # \u7cfb\u7edf\u73af\u5883\u53d8\u91cf<br \/>\necho $PATH            # \u547d\u4ee4\u641c\u7d22\u8def\u5f84<\/p>\n<h4>2. \u4f4d\u7f6e\u53c2\u6570<\/h4>\n<p># script.sh<br \/>\necho &#034;\u811a\u672c\u540d: $0&#034;<br \/>\necho &#034;\u7b2c\u4e00\u4e2a\u53c2\u6570: $1&#034;<br \/>\necho &#034;\u7b2c\u4e8c\u4e2a\u53c2\u6570: $2&#034;<br \/>\necho &#034;\u53c2\u6570\u603b\u6570: $#&#034;<br \/>\necho &#034;\u6240\u6709\u53c2\u6570: $*&#034;<\/p>\n<h4>3. \u5206\u652f\u8bed\u53e5<\/h4>\n<h5>if \u6761\u4ef6\u5224\u65ad<\/h5>\n<p>if [ -f &#034;file.txt&#034; ]; then<br \/>\n    echo &#034;\u6587\u4ef6\u5b58\u5728&#034;<br \/>\nelif [ -d &#034;dir&#034; ]; then<br \/>\n    echo &#034;\u76ee\u5f55\u5b58\u5728&#034;<br \/>\nelse<br \/>\n    echo &#034;\u90fd\u4e0d\u5b58\u5728&#034;<br \/>\nfi<\/p>\n<h5>case \u591a\u6761\u4ef6\u5339\u914d<\/h5>\n<p>case $1 in<br \/>\n    start)<br \/>\n        echo &#034;\u542f\u52a8\u670d\u52a1&#034;<br \/>\n        ;;<br \/>\n    stop)<br \/>\n        echo &#034;\u505c\u6b62\u670d\u52a1&#034;<br \/>\n        ;;<br \/>\n    restart)<br \/>\n        echo &#034;\u91cd\u542f\u670d\u52a1&#034;<br \/>\n        ;;<br \/>\n    *)<br \/>\n        echo &#034;\u7528\u6cd5: $0 {start|stop|restart}&#034;<br \/>\n        ;;<br \/>\nesac<\/p>\n<h4>4. \u5faa\u73af\u8bed\u53e5<\/h4>\n<h5>for \u5faa\u73af<\/h5>\n<p># \u904d\u5386\u5217\u8868<br \/>\nfor i in 1 2 3 4 5; do<br \/>\n    echo &#034;\u6570\u5b57: $i&#034;<br \/>\ndone<\/p>\n<p># \u904d\u5386\u6587\u4ef6<br \/>\nfor file in *.txt; do<br \/>\n    echo &#034;\u5904\u7406: $file&#034;<br \/>\ndone<\/p>\n<h5>while \u5faa\u73af<\/h5>\n<p>count&#061;1<br \/>\nwhile [ $count -le 5 ]; do<br \/>\n    echo &#034;\u8ba1\u6570: $count&#034;<br \/>\n    count&#061;$((count &#043; 1))<br \/>\ndone<\/p>\n<h5>until \u5faa\u73af<\/h5>\n<p>count&#061;1<br \/>\nuntil [ $count -gt 5 ]; do<br \/>\n    echo &#034;\u8ba1\u6570: $count&#034;<br \/>\n    count&#061;$((count &#043; 1))<br \/>\ndone<\/p>\n<h3>\u4e03\u3001Shell vs C \u8bed\u8a00 \u9002\u7528\u573a\u666f\u5bf9\u6bd4<\/h3>\n<table>\n<tr>\n<p>\u7279\u6027<\/p>\n<p>Shell \u811a\u672c<\/p>\n<p>C \u8bed\u8a00<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>\u6267\u884c\u65b9\u5f0f<\/p>\n<\/td>\n<td>\n<p>\u89e3\u91ca\u6267\u884c&#xff08;\u5373\u65f6&#xff09;<\/p>\n<\/td>\n<td>\n<p>\u7f16\u8bd1\u6267\u884c&#xff08;\u9700\u7f16\u8bd1&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u8bed\u6cd5<\/p>\n<\/td>\n<td>\n<p>\u7b80\u6d01\u7075\u6d3b&#xff0c;\u65e0\u7c7b\u578b\u58f0\u660e<\/p>\n<\/td>\n<td>\n<p>\u4e25\u683c\u89c4\u8303&#xff0c;\u5f3a\u7c7b\u578b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u5f00\u53d1\u6548\u7387<\/p>\n<\/td>\n<td>\n<p>\u9ad8&#xff08;\u51e0\u884c\u5b8c\u6210\u6587\u4ef6\u64cd\u4f5c&#xff09;<\/p>\n<\/td>\n<td>\n<p>\u4f4e&#xff08;\u9700\u5904\u7406\u5e95\u5c42\u7ec6\u8282&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u6267\u884c\u6548\u7387<\/p>\n<\/td>\n<td>\n<p>\u8f83\u4f4e&#xff08;\u9010\u884c\u89e3\u91ca&#xff09;<\/p>\n<\/td>\n<td>\n<p>\u9ad8&#xff08;\u76f4\u63a5\u673a\u5668\u7801&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u9002\u7528\u573a\u666f<\/p>\n<\/td>\n<td>\n<p>\u7cfb\u7edf\u7ba1\u7406\u3001\u81ea\u52a8\u5316\u3001\u6587\u672c\u5904\u7406<\/p>\n<\/td>\n<td>\n<p>\u7cfb\u7edf\u8f6f\u4ef6\u3001\u9a71\u52a8\u3001\u6027\u80fd\u654f\u611f\u5e94\u7528<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u793a\u4f8b\u5bf9\u6bd4<\/p>\n<p># Shell\u7248&#xff1a;\u7edf\u8ba1\u6587\u672c\u884c\u6570<br \/>\nwc -l file.txt<\/p>\n<p># C\u7248&#xff1a;\u7edf\u8ba1\u6587\u672c\u884c\u6570<br \/>\n#include &lt;stdio.h&gt;<br \/>\nint main() {<br \/>\n    FILE *fp &#061; fopen(&#034;file.txt&#034;, &#034;r&#034;);<br \/>\n    int count &#061; 0;<br \/>\n    char ch;<br \/>\n    while((ch &#061; fgetc(fp)) !&#061; EOF)<br \/>\n        if(ch &#061;&#061; &#039;\\\\n&#039;) count&#043;&#043;;<br \/>\n    printf(&#034;%d\\\\n&#034;, count);<br \/>\n    fclose(fp);<br \/>\n    return 0;<br \/>\n}<\/p>\n<h3 style=\"background-color:transparent\">\u516b\u3001\u5b66\u4e60\u5efa\u8bae \u4ece\u5165\u95e8\u5230\u7cbe\u901a<\/h3>\n<li>\n<p>\u5faa\u5e8f\u6e10\u8fdb&#xff1a;\u5148\u638c\u63e1 ls\/cd\/pwd \u7b49\u57fa\u7840\u547d\u4ee4&#xff0c;\u518d\u5b66\u7ba1\u9053\/\u91cd\u5b9a\u5411<\/p>\n<\/li>\n<li>\n<p>\u591a\u7528\u591a\u7ec3&#xff1a;\u5728\u865a\u62df\u673a\u6216\u6811\u8393\u6d3e\u7b49\u8bbe\u5907\u4e0a\u5b9e\u9645\u64cd\u4f5c<\/p>\n<\/li>\n<li>\n<p>\u5584\u7528\u5e2e\u52a9&#xff1a;man \u547d\u4ee4\u6216 \u547d\u4ee4 &#8211;help\u67e5\u770b\u624b\u518c<\/p>\n<\/li>\n<li>\n<p>\u8bb0\u7b14\u8bb0&#xff1a;\u6574\u7406\u5e38\u7528\u547d\u4ee4\u548c\u811a\u672c\u7247\u6bb5<\/p>\n<\/li>\n<li>\n<p>\u9605\u8bfb\u6e90\u7801&#xff1a;\u7814\u7a76\u5f00\u6e90\u9879\u76ee\u7684\u542f\u52a8\u811a\u672c\u548c Makefile<\/p>\n<\/li>\n<h3>\u4e5d\u3001\u603b\u7ed3<\/h3>\n<p>Shell \u662f\u5d4c\u5165\u5f0f Linux \u5f00\u53d1\u7684\u57fa\u77f3\u5de5\u5177\u3002\u57fa\u7840\u547d\u4ee4\u662f\u7816\u74e6&#xff0c;\u7ba1\u9053\u91cd\u5b9a\u5411\u662f\u7c98\u5408\u5242&#xff0c;Shell \u811a\u672c\u662f\u8bbe\u8ba1\u56fe\u3002\u4ece\u7b80\u5355\u7684\u6587\u4ef6\u64cd\u4f5c\u5230\u590d\u6742\u7684\u81ea\u52a8\u5316\u811a\u672c&#xff0c;\u638c\u63e1 Shell \u80fd\u6781\u5927\u63d0\u5347\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<p>\u8bb0\u4f4f\u51e0\u4e2a\u6838\u5fc3\u539f\u5219&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u7ba1\u9053\u8fde\u63a5\u4e00\u5207&#xff1a;\u4e00\u4e2a\u547d\u4ee4\u505a\u4e00\u4ef6\u4e8b&#xff0c;\u7ba1\u9053\u4e32\u8054\u590d\u6742\u529f\u80fd<\/p>\n<\/li>\n<li>\n<p>\u6743\u9650\u6700\u5c0f\u5316&#xff1a;\u6309\u9700\u5206\u914d\u6743\u9650&#xff0c;\u907f\u514d 777<\/p>\n<\/li>\n<li>\n<p>\u811a\u672c\u6a21\u5757\u5316&#xff1a;\u590d\u6742\u4efb\u52a1\u62c6\u5206\u6210\u7b80\u5355\u51fd\u6570<\/p>\n<\/li>\n<li>\n<p>\u9519\u8bef\u5904\u7406&#xff1a;\u811a\u672c\u4e2d\u68c0\u67e5\u547d\u4ee4\u6267\u884c\u7ed3\u679c<\/p>\n<\/li>\n<\/ul>\n<p>\u6700\u540e&#xff0c;\u6253\u5f00\u7ec8\u7aef&#xff0c;\u4ece ls -la\u5f00\u59cb\u4f60\u7684 Shell \u63a2\u7d22\u4e4b\u65c5\u3002\u771f\u6b63\u7684\u638c\u63e1\u6e90\u4e8e\u5b9e\u8df5&#xff0c;\u8ba9\u547d\u4ee4\u6210\u4e3a\u4f60\u601d\u8003\u7684\u4e00\u90e8\u5206\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001Shell \u672c\u8d28 \u4eba\u673a\u5bf9\u8bdd\u7684\u201c\u7ffb\u8bd1\u5b98\u201d\u5f53\u4f60\u9762\u5bf9\u4e00\u53f0\u5d4c\u5165\u5f0f Linux \u8bbe\u5907&#xff08;\u5982\u667a\u80fd\u97f3\u7bb1\u3001\u8def\u7531\u5668&#xff09;&#xff0c;\u5982\u4f55\u8ba9\u5b83\u6267\u884c\u4f60\u7684\u6307\u4ee4&#xff1f;Shell \u5c31\u662f\u8fd9\u4e2a\u201c\u5bf9\u8bdd\u7ffb\u8bd1\u5b98\u201d\u3002\u5b83\u63a5\u6536\u4f60\u7684\u6587\u672c\u547d\u4ee4&#xff0c;\u7ffb\u8bd1\u6210\u5185\u6838\u80fd\u7406\u89e3\u7684\u8bed\u8a00&#xff0c;\u518d\u5c06\u7ed3\u679c\u8fd4\u56de\u7ed9\u4f60\u3002\u7ec8\u7aef\u7a97\u53e3\u5c31\u662f\u4f60\u4e0e Shell \u4ea4\u4e92\u7684\u754c\u9762&#xff0c;\u800c Shell \u811a\u672c\u5219\u662f\u5c06\u591a\u4e2a\u547d\u4ee4\u7ec4\u5408\u6210\u81ea\u52a8\u5316\u7a0b\u5e8f\u7684\u5de5\u5177\u3002\u7406\u89e3\u8fd9\u4e00\u70b9&#xff0c;\u662f\u638c\u63e1 Linux \u547d\u4ee4\u884c\u7684\u7b2c\u4e00\u6b65<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7615,7613,7614,58,1468,473],"topic":[],"class_list":{"0":"post-72512","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-server","7":"tag-shell","9":"tag-7614","10":"tag-linux"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5d4c\u5165\u5f0fLinux\u5f00\u53d1\u5fc5\u5b66Shell \u4ece\u57fa\u7840\u547d\u4ee4\u5230\u811a\u672c\u81ea\u52a8\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/72512.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5d4c\u5165\u5f0fLinux\u5f00\u53d1\u5fc5\u5b66Shell \u4ece\u57fa\u7840\u547d\u4ee4\u5230\u811a\u672c\u81ea\u52a8\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001Shell \u672c\u8d28 \u4eba\u673a\u5bf9\u8bdd\u7684\u201c\u7ffb\u8bd1\u5b98\u201d\u5f53\u4f60\u9762\u5bf9\u4e00\u53f0\u5d4c\u5165\u5f0f Linux \u8bbe\u5907&#xff08;\u5982\u667a\u80fd\u97f3\u7bb1\u3001\u8def\u7531\u5668&#xff09;&#xff0c;\u5982\u4f55\u8ba9\u5b83\u6267\u884c\u4f60\u7684\u6307\u4ee4&#xff1f;Shell \u5c31\u662f\u8fd9\u4e2a\u201c\u5bf9\u8bdd\u7ffb\u8bd1\u5b98\u201d\u3002\u5b83\u63a5\u6536\u4f60\u7684\u6587\u672c\u547d\u4ee4&#xff0c;\u7ffb\u8bd1\u6210\u5185\u6838\u80fd\u7406\u89e3\u7684\u8bed\u8a00&#xff0c;\u518d\u5c06\u7ed3\u679c\u8fd4\u56de\u7ed9\u4f60\u3002\u7ec8\u7aef\u7a97\u53e3\u5c31\u662f\u4f60\u4e0e Shell \u4ea4\u4e92\u7684\u754c\u9762&#xff0c;\u800c Shell \u811a\u672c\u5219\u662f\u5c06\u591a\u4e2a\u547d\u4ee4\u7ec4\u5408\u6210\u81ea\u52a8\u5316\u7a0b\u5e8f\u7684\u5de5\u5177\u3002\u7406\u89e3\u8fd9\u4e00\u70b9&#xff0c;\u662f\u638c\u63e1 Linux \u547d\u4ee4\u884c\u7684\u7b2c\u4e00\u6b65\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/72512.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-05T12:49:19+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72512.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/72512.html\",\"name\":\"\u5d4c\u5165\u5f0fLinux\u5f00\u53d1\u5fc5\u5b66Shell \u4ece\u57fa\u7840\u547d\u4ee4\u5230\u811a\u672c\u81ea\u52a8\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-05T12:49:19+00:00\",\"dateModified\":\"2026-02-05T12:49:19+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/72512.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/72512.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72512.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5d4c\u5165\u5f0fLinux\u5f00\u53d1\u5fc5\u5b66Shell \u4ece\u57fa\u7840\u547d\u4ee4\u5230\u811a\u672c\u81ea\u52a8\u5316\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5d4c\u5165\u5f0fLinux\u5f00\u53d1\u5fc5\u5b66Shell \u4ece\u57fa\u7840\u547d\u4ee4\u5230\u811a\u672c\u81ea\u52a8\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/72512.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5d4c\u5165\u5f0fLinux\u5f00\u53d1\u5fc5\u5b66Shell \u4ece\u57fa\u7840\u547d\u4ee4\u5230\u811a\u672c\u81ea\u52a8\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001Shell \u672c\u8d28 \u4eba\u673a\u5bf9\u8bdd\u7684\u201c\u7ffb\u8bd1\u5b98\u201d\u5f53\u4f60\u9762\u5bf9\u4e00\u53f0\u5d4c\u5165\u5f0f Linux \u8bbe\u5907&#xff08;\u5982\u667a\u80fd\u97f3\u7bb1\u3001\u8def\u7531\u5668&#xff09;&#xff0c;\u5982\u4f55\u8ba9\u5b83\u6267\u884c\u4f60\u7684\u6307\u4ee4&#xff1f;Shell \u5c31\u662f\u8fd9\u4e2a\u201c\u5bf9\u8bdd\u7ffb\u8bd1\u5b98\u201d\u3002\u5b83\u63a5\u6536\u4f60\u7684\u6587\u672c\u547d\u4ee4&#xff0c;\u7ffb\u8bd1\u6210\u5185\u6838\u80fd\u7406\u89e3\u7684\u8bed\u8a00&#xff0c;\u518d\u5c06\u7ed3\u679c\u8fd4\u56de\u7ed9\u4f60\u3002\u7ec8\u7aef\u7a97\u53e3\u5c31\u662f\u4f60\u4e0e Shell \u4ea4\u4e92\u7684\u754c\u9762&#xff0c;\u800c Shell \u811a\u672c\u5219\u662f\u5c06\u591a\u4e2a\u547d\u4ee4\u7ec4\u5408\u6210\u81ea\u52a8\u5316\u7a0b\u5e8f\u7684\u5de5\u5177\u3002\u7406\u89e3\u8fd9\u4e00\u70b9&#xff0c;\u662f\u638c\u63e1 Linux \u547d\u4ee4\u884c\u7684\u7b2c\u4e00\u6b65","og_url":"https:\/\/www.wsisp.com\/helps\/72512.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-05T12:49:19+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/72512.html","url":"https:\/\/www.wsisp.com\/helps\/72512.html","name":"\u5d4c\u5165\u5f0fLinux\u5f00\u53d1\u5fc5\u5b66Shell \u4ece\u57fa\u7840\u547d\u4ee4\u5230\u811a\u672c\u81ea\u52a8\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-05T12:49:19+00:00","dateModified":"2026-02-05T12:49:19+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/72512.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/72512.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/72512.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5d4c\u5165\u5f0fLinux\u5f00\u53d1\u5fc5\u5b66Shell \u4ece\u57fa\u7840\u547d\u4ee4\u5230\u811a\u672c\u81ea\u52a8\u5316"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=72512"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72512\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=72512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=72512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=72512"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=72512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}