{"id":88331,"date":"2026-07-31T22:48:30","date_gmt":"2026-07-31T14:48:30","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/88331.html"},"modified":"2026-07-31T22:48:30","modified_gmt":"2026-07-31T14:48:30","slug":"linux-%e5%9f%ba%e7%a1%80%e6%8c%87%e4%bb%a4%ef%bc%88%e4%ba%8c%ef%bc%89%ef%bc%9a%e6%96%87%e4%bb%b6%e5%a4%8d%e5%88%b6%e7%a7%bb%e5%8a%a8%e3%80%81%e5%86%85%e5%ae%b9%e6%9f%a5%e7%9c%8b%e3%80%81%e6%97%b6","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/88331.html","title":{"rendered":"Linux \u57fa\u7840\u6307\u4ee4\uff08\u4e8c\uff09\uff1a\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e"},"content":{"rendered":"<h2>Linux \u57fa\u7840\u6307\u4ee4&#xff08;\u4e8c&#xff09;&#xff1a;\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260731144829-6a6cb5bd7f0ec.png\" alt=\"\u5934\u50cf\" \/><\/p>\n<p> <font color=\"#FF4D4F\" size=\"4\"><b>&#x1f525; \u661f\u6052\u968f\u98ce&#xff1a;<\/b><\/font><br \/>\n <font color=\"#FF4D4F\" size=\"4\"><b>\u4e2a\u4eba\u4e3b\u9875<\/b><\/font><\/p>\n<p> <font color=\"#66CCFF\" size=\"3\"><b>\u2744\ufe0f \u4e2a\u4eba\u4e13\u680f&#xff1a;<\/b><\/font><br \/>\n <font color=\"#66CCFF\" size=\"3\"><b>\u300a\u6307\u9488\u5408\u96c6\u300b<\/b><\/font><br \/>\n <font color=\"#333333\" size=\"3\"><b>&#xff5c;<\/b><\/font><br \/>\n <font color=\"#66CCFF\" size=\"3\"><b>\u300aC\u8bed\u8a00\u57fa\u7840\u300b<\/b><\/font><br \/>\n <font color=\"#333333\" size=\"3\"><b>&#xff5c;<\/b><\/font><br \/>\n <font color=\"#66CCFF\" size=\"3\"><b>\u300a\u6570\u636e\u7ed3\u6784\u300b<\/b><\/font><br \/>\n <font color=\"#333333\" size=\"3\"><b>&#xff5c;<\/b><\/font><br \/>\n <font color=\"#66CCFF\" size=\"3\"><b>\u300a\u673a\u5668\u5b66\u4e60\u5bfc\u8bba\u300b<\/b><\/font><br \/>\n <font color=\"#333333\" size=\"3\"><b>&#xff5c;<\/b><\/font><br \/>\n <font color=\"#66CCFF\" size=\"3\"><b>\u300a\u524d\u7aef\u57fa\u7840\u300b<\/b><\/font><br \/>\n <font color=\"#333333\" size=\"3\"><b>&#xff5c;<\/b><\/font><br \/>\n <font color=\"#66CCFF\" size=\"3\"><b>\u300apython\u57fa\u7840\u300b<\/b><\/font><br \/>\n <font color=\"#333333\" size=\"3\"><b>&#xff5c;<\/b><\/font><br \/>\n <font color=\"#66CCFF\" size=\"3\"><b>\u300aC&#043;&#043;\u4ece\u5165\u95e8\u5230\u5165\u571f\u300b<\/b><\/font><br \/>\n <font color=\"#333333\" size=\"3\"><b>&#xff5c;<\/b><\/font><br \/>\n <font color=\"#66CCFF\" size=\"3\"><b>\u300aLinux\u7684\u5b66\u4e60\u4e4b\u65c5\u300b<\/b><\/font> <\/p>\n<p> <font color=\"#F5B400\" size=\"5\"><b>\u2728 \u6570\u636e\u5373\u77e5\u8bc6&#xff0c;\u538b\u7f29\u5373\u667a\u80fd<\/b><\/font><\/p>\n<hr \/>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>Linux \u57fa\u7840\u6307\u4ee4&#xff08;\u4e8c&#xff09;&#xff1a;\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e<\/li>\n<li>\n<ul>\n<li>\u524d\u8a00<\/li>\n<li>\u4e00\u3001rm \u547d\u4ee4\u7684\u8fdb\u4e00\u6b65\u8865\u5145<\/li>\n<li>\n<ul>\n<li>1.1 \u5220\u9664\u6587\u4ef6\u524d\u8be2\u95ee<\/li>\n<li>1.2 \u9012\u5f52\u5220\u9664\u5e76\u9010\u9879\u8be2\u95ee<\/li>\n<li>1.3 \u5f3a\u5236\u9012\u5f52\u5220\u9664<\/li>\n<\/ul>\n<\/li>\n<li>\u4e8c\u3001man&#xff1a;\u4e0d\u4f1a\u7528\u547d\u4ee4\u65f6\u5148\u67e5\u624b\u518c<\/li>\n<li>\n<ul>\n<li>2.1 \u57fa\u672c\u8bed\u6cd5<\/li>\n<li>2.2 man \u624b\u518c\u7684\u7ae0\u8282<\/li>\n<li>2.3 \u540c\u540d\u5185\u5bb9\u4e3a\u4ec0\u4e48\u9700\u8981\u6307\u5b9a\u7ae0\u8282&#xff1f;<\/li>\n<li>2.4 \u67e5\u770b\u6240\u6709\u540c\u540d\u624b\u518c\u9875<\/li>\n<li>2.5 \u6839\u636e\u5173\u952e\u5b57\u641c\u7d22\u624b\u518c<\/li>\n<li>2.6 \u67e5\u770b man \u81ea\u5df1\u7684\u624b\u518c<\/li>\n<li>2.7 \u5176\u4ed6\u5e2e\u52a9\u65b9\u5f0f<\/li>\n<\/ul>\n<\/li>\n<li>\u4e09\u3001cp&#xff1a;\u590d\u5236\u6587\u4ef6\u548c\u76ee\u5f55<\/li>\n<li>\n<ul>\n<li>3.1 \u57fa\u672c\u8bed\u6cd5<\/li>\n<li>3.2 \u590d\u5236\u4e00\u4e2a\u666e\u901a\u6587\u4ef6<\/li>\n<li>3.3 \u590d\u5236\u5230\u6307\u5b9a\u76ee\u5f55<\/li>\n<li>3.4 \u590d\u5236\u65f6\u4fee\u6539\u6587\u4ef6\u540d<\/li>\n<li>3.5 \u4e00\u6b21\u590d\u5236\u591a\u4e2a\u6587\u4ef6<\/li>\n<li>3.6 \u4f7f\u7528\u901a\u914d\u7b26\u590d\u5236<\/li>\n<li>3.7 \u8986\u76d6\u76ee\u6807\u6587\u4ef6<\/li>\n<li>3.8 \u9012\u5f52\u590d\u5236\u76ee\u5f55<\/li>\n<li>3.9 \u4f7f\u7528\u5f52\u6863\u6a21\u5f0f\u590d\u5236<\/li>\n<li>3.10 \u5e38\u7528\u9009\u9879<\/li>\n<\/ul>\n<\/li>\n<li>\u56db\u3001mv&#xff1a;\u79fb\u52a8\u6587\u4ef6\u3001\u79fb\u52a8\u76ee\u5f55\u548c\u91cd\u547d\u540d<\/li>\n<li>\n<ul>\n<li>4.1 \u4fee\u6539\u6587\u4ef6\u540d<\/li>\n<li>4.2 \u79fb\u52a8\u6587\u4ef6\u5230\u53e6\u4e00\u4e2a\u76ee\u5f55<\/li>\n<li>4.3 \u79fb\u52a8\u5e76\u91cd\u547d\u540d<\/li>\n<li>4.4 \u79fb\u52a8\u6574\u4e2a\u76ee\u5f55<\/li>\n<li>4.5 \u76ee\u6807\u6587\u4ef6\u5df2\u5b58\u5728<\/li>\n<li>4.6 \u5e38\u7528\u9009\u9879<\/li>\n<li>4.7 cp \u548c mv \u7684\u533a\u522b<\/li>\n<\/ul>\n<\/li>\n<li>\u4e94\u3001cat&#xff1a;\u67e5\u770b\u548c\u8fde\u63a5\u6587\u672c\u6587\u4ef6<\/li>\n<li>\n<ul>\n<li>5.1 \u67e5\u770b\u4e00\u4e2a\u5c0f\u578b\u6587\u672c\u6587\u4ef6<\/li>\n<li>5.2 \u540c\u65f6\u67e5\u770b\u591a\u4e2a\u6587\u4ef6<\/li>\n<li>5.3 \u4e3a\u6240\u6709\u8f93\u51fa\u884c\u6dfb\u52a0\u7f16\u53f7<\/li>\n<li>5.4 \u53ea\u7ed9\u975e\u7a7a\u884c\u7f16\u53f7<\/li>\n<li>5.5 \u538b\u7f29\u8fde\u7eed\u7a7a\u884c<\/li>\n<li>5.6 \u5e38\u7528\u9009\u9879<\/li>\n<li>5.7 cat \u4e0d\u9002\u5408\u7f16\u8f91\u6587\u4ef6<\/li>\n<\/ul>\n<\/li>\n<li>\u516d\u3001\u91cd\u5b9a\u5411&#xff1a;\u628a\u8f93\u51fa\u5199\u5165\u6587\u4ef6<\/li>\n<li>\n<ul>\n<li>6.1 \u6807\u51c6\u8f93\u51fa<\/li>\n<li>6.2 &#096;&gt;&#096; \u4f1a\u8986\u76d6\u539f\u6587\u4ef6<\/li>\n<li>6.3 &#096;&gt;&gt;&#096; \u4f1a\u8ffd\u52a0\u5185\u5bb9<\/li>\n<li>6.4 \u4f7f\u7528\u5faa\u73af\u751f\u6210\u6d4b\u8bd5\u6587\u4ef6<\/li>\n<\/ul>\n<\/li>\n<li>\u4e03\u3001more&#xff1a;\u5206\u9875\u67e5\u770b\u6587\u4ef6<\/li>\n<li>\n<ul>\n<li>7.1 \u57fa\u672c\u8bed\u6cd5<\/li>\n<li>7.2 \u5e38\u7528\u64cd\u4f5c<\/li>\n<li>7.3 \u6307\u5b9a\u6bcf\u9875\u663e\u793a\u884c\u6570<\/li>\n<li>7.4 more \u7684\u5c40\u9650<\/li>\n<\/ul>\n<\/li>\n<li>\u516b\u3001less&#xff1a;\u66f4\u7075\u6d3b\u5730\u6d4f\u89c8\u957f\u6587\u672c<\/li>\n<li>\n<ul>\n<li>8.1 \u57fa\u672c\u8bed\u6cd5<\/li>\n<li>8.2 \u5e38\u7528\u6309\u952e<\/li>\n<li>8.3 \u663e\u793a\u884c\u53f7<\/li>\n<li>8.4 \u641c\u7d22\u65f6\u5ffd\u7565\u5927\u5c0f\u5199<\/li>\n<li>8.5 more \u548c less \u5bf9\u6bd4<\/li>\n<\/ul>\n<\/li>\n<li>\u4e5d\u3001head&#xff1a;\u67e5\u770b\u6587\u4ef6\u5f00\u5934<\/li>\n<li>\n<ul>\n<li>9.1 \u57fa\u672c\u8bed\u6cd5<\/li>\n<li>9.2 \u6307\u5b9a\u663e\u793a\u884c\u6570<\/li>\n<li>9.3 \u5e38\u89c1\u4f7f\u7528\u573a\u666f<\/li>\n<\/ul>\n<\/li>\n<li>\u5341\u3001tail&#xff1a;\u67e5\u770b\u6587\u4ef6\u7ed3\u5c3e\u548c\u8ddf\u8e2a\u65e5\u5fd7<\/li>\n<li>\n<ul>\n<li>10.1 \u9ed8\u8ba4\u67e5\u770b\u6700\u540e 10 \u884c<\/li>\n<li>10.2 \u6307\u5b9a\u663e\u793a\u884c\u6570<\/li>\n<li>10.3 \u5b9e\u65f6\u8ddf\u8e2a\u65e5\u5fd7<\/li>\n<li>10.4 \u6a21\u62df\u52a8\u6001\u65e5\u5fd7<\/li>\n<li>10.5 &#096;tail -F&#096;<\/li>\n<li>10.6 head \u548c tail \u5bf9\u6bd4<\/li>\n<\/ul>\n<\/li>\n<li>\u5341\u4e00\u3001\u7ba1\u9053&#xff1a;\u628a\u4e00\u4e2a\u547d\u4ee4\u7684\u8f93\u51fa\u4ea4\u7ed9\u53e6\u4e00\u4e2a\u547d\u4ee4<\/li>\n<li>\n<ul>\n<li>11.1 \u67e5\u770b\u67d0\u4e00\u6bb5\u884c<\/li>\n<li>11.2 \u7edf\u8ba1\u76ee\u5f55\u4e2d\u7684\u524d\u51e0\u9879<\/li>\n<li>11.3 \u5728\u8f93\u51fa\u4e2d\u641c\u7d22<\/li>\n<li>11.4 \u7ba1\u9053\u548c\u91cd\u5b9a\u5411\u7684\u533a\u522b<\/li>\n<\/ul>\n<\/li>\n<li>\u5341\u4e8c\u3001date&#xff1a;\u67e5\u770b\u548c\u683c\u5f0f\u5316\u65f6\u95f4<\/li>\n<li>\n<ul>\n<li>12.1 \u67e5\u770b\u5f53\u524d\u65f6\u95f4<\/li>\n<li>12.2 \u81ea\u5b9a\u4e49\u8f93\u51fa\u683c\u5f0f<\/li>\n<li>12.3 \u5e38\u89c1\u683c\u5f0f\u7b26<\/li>\n<li>12.4 Unix \u65f6\u95f4\u6233<\/li>\n<li>12.5 \u628a\u65f6\u95f4\u6233\u8f6c\u6362\u4e3a\u53ef\u8bfb\u65f6\u95f4<\/li>\n<li>12.6 \u8bbe\u7f6e\u7cfb\u7edf\u65f6\u95f4<\/li>\n<\/ul>\n<\/li>\n<li>\u5341\u4e09\u3001cal&#xff1a;\u67e5\u770b\u65e5\u5386<\/li>\n<li>\n<ul>\n<li>13.1 \u67e5\u770b\u5f53\u524d\u6708\u4efd<\/li>\n<li>13.2 \u67e5\u770b\u6307\u5b9a\u5e74\u4efd<\/li>\n<li>13.3 \u67e5\u770b\u6307\u5b9a\u6708\u4efd<\/li>\n<li>13.4 \u67e5\u770b\u76f8\u90bb\u4e09\u4e2a\u6708<\/li>\n<li>13.5 \u67e5\u770b\u5168\u5e74<\/li>\n<li>13.6 \u663e\u793a\u4e00\u5e74\u4e2d\u7684\u7b2c\u51e0\u5929<\/li>\n<\/ul>\n<\/li>\n<li>\u5341\u56db\u3001find&#xff1a;\u5728\u76ee\u5f55\u6811\u4e2d\u67e5\u627e\u6587\u4ef6<\/li>\n<li>\n<ul>\n<li>14.1 \u57fa\u672c\u8bed\u6cd5<\/li>\n<li>14.2 \u6309\u6587\u4ef6\u540d\u67e5\u627e<\/li>\n<li>14.3 \u5ffd\u7565\u6587\u4ef6\u540d\u5927\u5c0f\u5199<\/li>\n<li>14.4 \u6309\u7c7b\u578b\u67e5\u627e<\/li>\n<li>14.5 \u9650\u5236\u641c\u7d22\u6df1\u5ea6<\/li>\n<li>14.6 \u6309\u6587\u4ef6\u5927\u5c0f\u67e5\u627e<\/li>\n<li>14.7 \u6309\u4fee\u6539\u65f6\u95f4\u67e5\u627e<\/li>\n<li>14.8 \u5bf9\u67e5\u627e\u7ed3\u679c\u6267\u884c\u64cd\u4f5c<\/li>\n<li>14.9 find \u548c\u666e\u901a\u6587\u4ef6\u540d\u67e5\u627e\u7684\u533a\u522b<\/li>\n<\/ul>\n<\/li>\n<li>\u5341\u4e94\u3001which&#xff1a;\u67e5\u627e\u547d\u4ee4\u5bf9\u5e94\u7684\u7a0b\u5e8f\u8def\u5f84<\/li>\n<li>\n<ul>\n<li>15.1 \u57fa\u672c\u4f7f\u7528<\/li>\n<li>15.2 PATH \u662f\u4ec0\u4e48&#xff1f;<\/li>\n<li>15.3 which \u4e0d\u4e00\u5b9a\u80fd\u8bf4\u660e\u5b9e\u9645\u6267\u884c\u7684\u5185\u5bb9<\/li>\n<li>15.4 \u4f7f\u7528 type \u67e5\u770b\u5b8c\u6574\u6765\u6e90<\/li>\n<li>15.5 \u5728\u811a\u672c\u4e2d\u4f7f\u7528 command -v<\/li>\n<\/ul>\n<\/li>\n<li>\u5341\u516d\u3001\u628a\u8fd9\u4e00\u9636\u6bb5\u7684\u547d\u4ee4\u4e32\u8d77\u6765<\/li>\n<li>\n<ul>\n<li>16.1 \u521b\u5efa\u7ec3\u4e60\u76ee\u5f55<\/li>\n<li>16.2 \u521b\u5efa\u6d4b\u8bd5\u6587\u4ef6<\/li>\n<li>16.3 \u67e5\u770b\u6587\u4ef6<\/li>\n<li>16.4 \u590d\u5236\u9879\u76ee<\/li>\n<li>16.5 \u79fb\u52a8\u6587\u4ef6<\/li>\n<li>16.6 \u67e5\u627e\u6587\u4ef6<\/li>\n<li>16.7 \u67e5\u770b\u547d\u4ee4\u8def\u5f84\u548c\u5e2e\u52a9<\/li>\n<li>16.8 \u6e05\u7406\u7ec3\u4e60\u76ee\u5f55<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u524d\u8a00<\/h3>\n<p>\u4e0a\u4e00\u7bc7\u6587\u7ae0\u5df2\u7ecf\u8bb2\u89e3\u4e86 Linux \u7684\u76ee\u5f55\u6811\u3001\u7edd\u5bf9\u8def\u5f84\u3001\u76f8\u5bf9\u8def\u5f84&#xff0c;\u4ee5\u53ca\u4e0b\u9762\u8fd9\u4e9b\u57fa\u7840\u547d\u4ee4&#xff1a;<\/p>\n<p>ls<br \/>\npwd<br \/>\ncd<br \/>\ntouch<br \/>\nmkdir<br \/>\nrmdir<br \/>\nrm<\/p>\n<p>\u638c\u63e1\u8fd9\u4e9b\u547d\u4ee4\u4ee5\u540e&#xff0c;\u6211\u4eec\u5df2\u7ecf\u80fd\u591f\u5b8c\u6210\u6700\u57fa\u672c\u7684\u6587\u4ef6\u521b\u5efa\u548c\u5220\u9664\u64cd\u4f5c\u3002<\/p>\n<p>\u4e0d\u8fc7&#xff0c;\u771f\u6b63\u4f7f\u7528 Linux \u65f6\u8fd8\u4f1a\u9047\u5230\u66f4\u591a\u95ee\u9898&#xff1a;<\/p>\n<p>\u4e00\u4e2a\u547d\u4ee4\u7684\u53c2\u6570\u5fd8\u4e86\u600e\u4e48\u529e&#xff1f;<br \/>\n\u600e\u6837\u590d\u5236\u6587\u4ef6\u548c\u76ee\u5f55&#xff1f;<br \/>\n\u600e\u6837\u79fb\u52a8\u6587\u4ef6\u6216\u8005\u4fee\u6539\u6587\u4ef6\u540d&#xff1f;<br \/>\n\u600e\u6837\u67e5\u770b\u4e00\u4e2a\u6587\u672c\u6587\u4ef6&#xff1f;<br \/>\n\u6587\u4ef6\u6709\u51e0\u5343\u884c\u65f6\u5e94\u8be5\u600e\u6837\u9605\u8bfb&#xff1f;<br \/>\n\u600e\u6837\u53ea\u67e5\u770b\u6587\u4ef6\u5f00\u5934\u6216\u7ed3\u5c3e\u7684\u5185\u5bb9&#xff1f;<br \/>\n\u600e\u6837\u628a\u4e00\u4e2a\u547d\u4ee4\u7684\u7ed3\u679c\u4ea4\u7ed9\u53e6\u4e00\u4e2a\u547d\u4ee4&#xff1f;<br \/>\n\u600e\u6837\u67e5\u770b\u5f53\u524d\u65f6\u95f4&#xff1f;<br \/>\n\u600e\u6837\u5728\u76ee\u5f55\u6811\u4e2d\u67e5\u627e\u6587\u4ef6&#xff1f;<br \/>\n\u600e\u6837\u627e\u5230\u4e00\u6761\u547d\u4ee4\u5bf9\u5e94\u7684\u53ef\u6267\u884c\u7a0b\u5e8f&#xff1f;<\/p>\n<p>\u672c\u6587\u56f4\u7ed5\u8fd9\u4e9b\u95ee\u9898\u7ee7\u7eed\u5b66\u4e60 Linux \u57fa\u7840\u6307\u4ee4\u3002<\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p>root&#xff1a;\u5f53\u524d\u767b\u5f55\u7528\u6237<br \/>\nxxx &#xff1a;\u7ecf\u8fc7\u533f\u540d\u5904\u7406\u7684\u4e3b\u673a\u540d<br \/>\n~   &#xff1a;\u5f53\u524d\u4f4d\u4e8e root \u7528\u6237\u7684\u5bb6\u76ee\u5f55<br \/>\n#   &#xff1a;\u8d85\u7ea7\u7528\u6237\u63d0\u793a\u7b26<\/p>\n<p>\u672c\u6587\u4f7f\u7528 root \u53ea\u662f\u4e3a\u4e86\u7edf\u4e00\u6f14\u793a\u683c\u5f0f\u3002\u5b9e\u9645\u5f00\u53d1\u4e2d&#xff0c;\u9664\u7cfb\u7edf\u7ba1\u7406\u64cd\u4f5c\u5916&#xff0c;\u66f4\u63a8\u8350\u4f7f\u7528\u666e\u901a\u7528\u6237\u5de5\u4f5c&#xff0c;\u5fc5\u8981\u65f6\u518d\u901a\u8fc7 sudo \u83b7\u53d6\u4e34\u65f6\u6743\u9650\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001rm \u547d\u4ee4\u7684\u8fdb\u4e00\u6b65\u8865\u5145<\/h3>\n<p>\u4e0a\u4e00\u7bc7\u5df2\u7ecf\u4ecb\u7ecd\u4e86 rm \u7684\u57fa\u672c\u7528\u6cd5&#xff1a;<\/p>\n<p><span class=\"token function\">rm<\/span> \u6587\u4ef6\u540d<br \/>\n<span class=\"token function\">rm<\/span> <span class=\"token parameter variable\">-r<\/span> \u76ee\u5f55\u540d<\/p>\n<p>\u8fd9\u91cc\u518d\u8865\u5145\u4e09\u4e2a\u5e38\u89c1\u9009\u9879&#xff1a;<\/p>\n<p>-i&#xff1a;\u5220\u9664\u524d\u8be2\u95ee<br \/>\n-r&#xff1a;\u9012\u5f52\u5904\u7406\u76ee\u5f55<br \/>\n-f&#xff1a;\u5f3a\u5236\u5904\u7406&#xff0c;\u4e0d\u8fdb\u884c\u5e38\u89c4\u8be2\u95ee<\/p>\n<h4>1.1 \u5220\u9664\u6587\u4ef6\u524d\u8be2\u95ee<\/h4>\n<p>\u5148\u521b\u5efa\u4e00\u4e2a\u6d4b\u8bd5\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mkdir -p \/root\/linux_demo<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cd \/root\/linux_demo<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># touch note.txt<\/span><\/p>\n<p>\u4f7f\u7528 -i \u5220\u9664&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># rm -i note.txt<\/span><br \/>\nrm: remove regular empty <span class=\"token function\">file<\/span> <span class=\"token string\">&#039;note.txt&#039;<\/span>? y<\/p>\n<p>\u8f93\u5165&#xff1a;<\/p>\n<p>y<\/p>\n<p>\u8868\u793a\u786e\u8ba4\u5220\u9664\u3002<\/p>\n<p>\u8f93\u5165&#xff1a;<\/p>\n<p>n<\/p>\n<p>\u8868\u793a\u53d6\u6d88\u5220\u9664\u3002<\/p>\n<p>\u521d\u5b66\u9636\u6bb5\u4f7f\u7528 rm -i&#xff0c;\u53ef\u4ee5\u51cf\u5c11\u8bef\u5220\u6587\u4ef6\u7684\u98ce\u9669\u3002<\/p>\n<h4>1.2 \u9012\u5f52\u5220\u9664\u5e76\u9010\u9879\u8be2\u95ee<\/h4>\n<p>\u521b\u5efa\u591a\u7ea7\u76ee\u5f55&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mkdir -p path1\/path2\/path3<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># touch path1\/file1.txt<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># touch path1\/path2\/file2.txt<\/span><\/p>\n<p>\u4f7f\u7528&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># rm -ri path1<\/span><\/p>\n<p>\u7cfb\u7edf\u4f1a\u9010\u6b65\u8be2\u95ee&#xff1a;<\/p>\n<p>\u662f\u5426\u8fdb\u5165 path1&#xff1f;<br \/>\n\u662f\u5426\u8fdb\u5165 path1\/path2&#xff1f;<br \/>\n\u662f\u5426\u5220\u9664\u5176\u4e2d\u7684\u6587\u4ef6&#xff1f;<br \/>\n\u662f\u5426\u5220\u9664\u5df2\u7ecf\u53d8\u7a7a\u7684\u76ee\u5f55&#xff1f;<\/p>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u6bd4\u8f83\u5b89\u5168&#xff0c;\u4f46\u76ee\u5f55\u4e2d\u9879\u76ee\u5f88\u591a\u65f6&#xff0c;\u9700\u8981\u8fdb\u884c\u5927\u91cf\u786e\u8ba4\u3002<\/p>\n<h4>1.3 \u5f3a\u5236\u9012\u5f52\u5220\u9664<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># rm -rf path1<\/span><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p>-r&#xff1a;\u9012\u5f52\u5220\u9664\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u5185\u5bb9<br \/>\n-f&#xff1a;\u4e0d\u8fdb\u884c\u5e38\u89c4\u8be2\u95ee<\/p>\n<p>rm -rf \u672c\u8eab\u662f\u4e00\u6761\u6b63\u5e38\u547d\u4ee4&#xff0c;\u5728\u6784\u5efa\u811a\u672c\u3001\u90e8\u7f72\u811a\u672c\u548c\u4e34\u65f6\u76ee\u5f55\u6e05\u7406\u4e2d\u90fd\u5f88\u5e38\u89c1\u3002<\/p>\n<p>\u5b83\u7684\u5371\u9669\u4e4b\u5904\u5728\u4e8e&#xff1a;<\/p>\n<p>\u5220\u9664\u8303\u56f4\u5b8c\u5168\u7531\u540e\u9762\u7684\u8def\u5f84\u51b3\u5b9a&#xff0c;\u800c\u4e14\u901a\u5e38\u4e0d\u4f1a\u7ed9\u51fa\u518d\u6b21\u786e\u8ba4\u7684\u673a\u4f1a\u3002<\/p>\n<p>\u6267\u884c\u524d\u81f3\u5c11\u8981\u786e\u8ba4&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">pwd<\/span><br \/>\n<span class=\"token function\">ls<\/span> <span class=\"token parameter variable\">-al<\/span> path1<\/p>\n<p>\u786e\u8ba4\u5f53\u524d\u76ee\u5f55\u548c\u76ee\u6807\u5185\u5bb9\u6ca1\u6709\u95ee\u9898\u540e&#xff0c;\u518d\u6267\u884c\u5220\u9664\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001man&#xff1a;\u4e0d\u4f1a\u7528\u547d\u4ee4\u65f6\u5148\u67e5\u624b\u518c<\/h3>\n<p>Linux \u547d\u4ee4\u5f88\u591a&#xff0c;\u6bcf\u4e2a\u547d\u4ee4\u53c8\u53ef\u80fd\u6709\u5927\u91cf\u9009\u9879\u3002<\/p>\n<p>\u6ca1\u6709\u5fc5\u8981\u628a\u6240\u6709\u53c2\u6570\u5168\u90e8\u80cc\u4e0b\u6765\u3002\u66f4\u91cd\u8981\u7684\u662f\u77e5\u9053&#xff1a;<\/p>\n<p>\u5fd8\u8bb0\u53c2\u6570\u4ee5\u540e&#xff0c;\u5e94\u8be5\u53bb\u54ea\u91cc\u67e5\u3002<\/p>\n<p>man \u662f Linux \u4e2d\u6700\u91cd\u8981\u7684\u5e2e\u52a9\u547d\u4ee4\u4e4b\u4e00\u3002<\/p>\n<h4>2.1 \u57fa\u672c\u8bed\u6cd5<\/h4>\n<p><span class=\"token function\">man<\/span> <span class=\"token punctuation\">[<\/span>\u7ae0\u8282\u53f7<span class=\"token punctuation\">]<\/span> \u547d\u4ee4\u6216\u4e3b\u9898<\/p>\n<p>\u4f8b\u5982\u67e5\u770b ls \u7684\u624b\u518c&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># man ls<\/span><\/p>\n<p>\u8fdb\u5165\u624b\u518c\u4ee5\u540e&#xff0c;\u5e38\u7528\u6309\u952e\u5982\u4e0b&#xff1a;<\/p>\n<table>\n<tr>\u6309\u952e\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>Space<\/td>\n<td>\u5411\u4e0b\u7ffb\u4e00\u9875<\/td>\n<\/tr>\n<tr>\n<td>Enter<\/td>\n<td>\u5411\u4e0b\u79fb\u52a8\u4e00\u884c<\/td>\n<\/tr>\n<tr>\n<td>b<\/td>\n<td>\u5411\u4e0a\u7ffb\u4e00\u9875<\/td>\n<\/tr>\n<tr>\n<td>\/\u5173\u952e\u5b57<\/td>\n<td>\u5411\u4e0b\u641c\u7d22\u5173\u952e\u5b57<\/td>\n<\/tr>\n<tr>\n<td>n<\/td>\n<td>\u8df3\u5230\u4e0b\u4e00\u4e2a\u5339\u914d\u9879<\/td>\n<\/tr>\n<tr>\n<td>N<\/td>\n<td>\u8df3\u5230\u4e0a\u4e00\u4e2a\u5339\u914d\u9879<\/td>\n<\/tr>\n<tr>\n<td>q<\/td>\n<td>\u9000\u51fa\u624b\u518c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u5982\u5728 ls \u624b\u518c\u4e2d\u641c\u7d22 recursive&#xff1a;<\/p>\n<p>\/recursive<\/p>\n<p>\u6309\u4e0b\u56de\u8f66\u540e&#xff0c;\u624b\u518c\u4f1a\u5b9a\u4f4d\u5230\u76f8\u5173\u5185\u5bb9\u3002<\/p>\n<h4>2.2 man \u624b\u518c\u7684\u7ae0\u8282<\/h4>\n<p>Linux \u7684 man \u624b\u518c\u6309\u7167\u5185\u5bb9\u5206\u4e3a\u591a\u4e2a\u7ae0\u8282\u3002<\/p>\n<p>\u5e38\u89c1\u7ae0\u8282\u5982\u4e0b&#xff1a;<\/p>\n<table>\n<tr>\u7ae0\u8282\u4e3b\u8981\u5185\u5bb9<\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>\u666e\u901a\u7528\u6237\u547d\u4ee4<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>Linux \u7cfb\u7edf\u8c03\u7528<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>C \u6807\u51c6\u5e93\u548c\u7cfb\u7edf\u5e93\u51fd\u6570<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>\u8bbe\u5907\u6587\u4ef6\u548c\u7279\u6b8a\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\u6587\u4ef6\u683c\u5f0f\u548c\u914d\u7f6e\u6587\u4ef6\u683c\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>\u6e38\u620f<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>\u6982\u8ff0\u3001\u534f\u8bae\u3001\u7ea6\u5b9a\u548c\u5176\u4ed6\u4e3b\u9898<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>\u7cfb\u7edf\u7ba1\u7406\u547d\u4ee4<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>\u5185\u6838\u76f8\u5173\u63a5\u53e3\u6216\u4f8b\u7a0b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0d\u540c\u7cfb\u7edf\u5b89\u88c5\u7684\u624b\u518c\u5185\u5bb9\u53ef\u80fd\u6709\u6240\u5dee\u5f02\u3002<\/p>\n<h4>2.3 \u540c\u540d\u5185\u5bb9\u4e3a\u4ec0\u4e48\u9700\u8981\u6307\u5b9a\u7ae0\u8282&#xff1f;<\/h4>\n<p>printf \u65e2\u53ef\u4ee5\u8868\u793a Shell \u547d\u4ee4&#xff0c;\u4e5f\u53ef\u4ee5\u8868\u793a C \u6807\u51c6\u5e93\u51fd\u6570\u3002<\/p>\n<p>\u67e5\u770b\u547d\u4ee4\u7248\u672c&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># man 1 printf<\/span><\/p>\n<p>\u67e5\u770b C \u5e93\u51fd\u6570&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># man 3 printf<\/span><\/p>\n<p>\u67e5\u770b\u7cfb\u7edf\u8c03\u7528 fork&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># man 2 fork<\/span><\/p>\n<p>\u67e5\u770b\u7cfb\u7edf\u8c03\u7528 open&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># man 2 open<\/span><\/p>\n<p>\u6307\u5b9a\u7ae0\u8282\u7684\u4ef7\u503c\u5728\u4e8e&#xff1a;<\/p>\n<p>\u5f53\u591a\u4e2a\u624b\u518c\u9875\u540d\u79f0\u76f8\u540c\u65f6&#xff0c;\u53ef\u4ee5\u660e\u786e\u544a\u8bc9 man \u60f3\u67e5\u770b\u54ea\u4e00\u79cd\u5185\u5bb9\u3002<\/p>\n<h4>2.4 \u67e5\u770b\u6240\u6709\u540c\u540d\u624b\u518c\u9875<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># man -a printf<\/span><\/p>\n<p>-a \u4f1a\u4f9d\u6b21\u6253\u5f00\u6240\u6709\u5339\u914d\u7684\u624b\u518c\u9875\u3002<\/p>\n<p>\u9000\u51fa\u5f53\u524d\u9875\u9762\u540e&#xff0c;man \u4f1a\u7ee7\u7eed\u5c1d\u8bd5\u6253\u5f00\u4e0b\u4e00\u4e2a\u5339\u914d\u7ed3\u679c\u3002<\/p>\n<h4>2.5 \u6839\u636e\u5173\u952e\u5b57\u641c\u7d22\u624b\u518c<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># man -k copy<\/span><\/p>\n<p>\u5b83\u4f1a\u5217\u51fa\u63cf\u8ff0\u4e2d\u5305\u542b copy \u7684\u76f8\u5173\u624b\u518c\u9875\u3002<\/p>\n<p>man -k \u7684\u6548\u679c\u901a\u5e38\u7c7b\u4f3c&#xff1a;<\/p>\n<p><span class=\"token function\">apropos<\/span> copy<\/p>\n<p>\u5982\u679c\u53ea\u8bb0\u5f97\u81ea\u5df1\u60f3\u505a\u4ec0\u4e48&#xff0c;\u5374\u60f3\u4e0d\u8d77\u547d\u4ee4\u540d\u79f0&#xff0c;\u53ef\u4ee5\u5148\u4f7f\u7528\u5173\u952e\u5b57\u641c\u7d22\u3002<\/p>\n<h4>2.6 \u67e5\u770b man \u81ea\u5df1\u7684\u624b\u518c<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># man man<\/span><\/p>\n<p>\u8fd9\u4e5f\u662f\u5b66\u4e60 Linux \u7684\u4e00\u4e2a\u91cd\u8981\u601d\u8def&#xff1a;<\/p>\n<p>\u60f3\u77e5\u9053 man \u600e\u4e48\u7528&#xff0c;\u5c31\u4f7f\u7528 man \u67e5\u770b man\u3002<\/p>\n<h4>2.7 \u5176\u4ed6\u5e2e\u52a9\u65b9\u5f0f<\/h4>\n<p>\u4e0d\u662f\u6240\u6709\u95ee\u9898\u90fd\u5fc5\u987b\u8fdb\u5165 man\u3002<\/p>\n<p>\u8bb8\u591a\u547d\u4ee4\u652f\u6301&#xff1a;<\/p>\n<p>\u547d\u4ee4 <span class=\"token parameter variable\">&#8211;help<\/span><\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp &#8211;help<\/span><\/p>\n<p>Bash \u5185\u5efa\u547d\u4ee4\u53ef\u4ee5\u4f7f\u7528&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># help cd<\/span><\/p>\n<p>\u5e38\u89c1\u5e2e\u52a9\u65b9\u5f0f\u53ef\u4ee5\u6982\u62ec\u4e3a&#xff1a;<\/p>\n<p>man \u547d\u4ee4       \u67e5\u770b\u5b8c\u6574\u624b\u518c<br \/>\n\u547d\u4ee4 &#8211;help    \u67e5\u770b\u7b80\u8981\u53c2\u6570\u8bf4\u660e<br \/>\nhelp \u5185\u5efa\u547d\u4ee4  \u67e5\u770b Bash \u5185\u5efa\u547d\u4ee4<br \/>\nman -k \u5173\u952e\u5b57  \u6839\u636e\u529f\u80fd\u63cf\u8ff0\u641c\u7d22\u624b\u518c<\/p>\n<hr \/>\n<h3>\u4e09\u3001cp&#xff1a;\u590d\u5236\u6587\u4ef6\u548c\u76ee\u5f55<\/h3>\n<p>cp \u662f&#xff1a;<\/p>\n<p>copy<\/p>\n<p>\u7684\u7f29\u5199&#xff0c;\u7528\u4e8e\u590d\u5236\u6587\u4ef6\u6216\u76ee\u5f55\u3002<\/p>\n<h4>3.1 \u57fa\u672c\u8bed\u6cd5<\/h4>\n<p><span class=\"token function\">cp<\/span> <span class=\"token punctuation\">[<\/span>\u9009\u9879<span class=\"token punctuation\">]<\/span> \u6e90\u6587\u4ef6 \u76ee\u6807\u4f4d\u7f6e<\/p>\n<p>\u4e5f\u53ef\u4ee5\u4e00\u6b21\u590d\u5236\u591a\u4e2a\u6e90\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token function\">cp<\/span> <span class=\"token punctuation\">[<\/span>\u9009\u9879<span class=\"token punctuation\">]<\/span> \u6e90\u6587\u4ef61 \u6e90\u6587\u4ef62 \u76ee\u6807\u76ee\u5f55<\/p>\n<p>\u9700\u8981\u6ce8\u610f&#xff1a;<\/p>\n<p>\u5f53\u6e90\u6587\u4ef6\u8d85\u8fc7\u4e00\u4e2a\u65f6&#xff0c;\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u5fc5\u987b\u662f\u5df2\u7ecf\u5b58\u5728\u7684\u76ee\u5f55\u3002<\/p>\n<h4>3.2 \u590d\u5236\u4e00\u4e2a\u666e\u901a\u6587\u4ef6<\/h4>\n<p>\u521b\u5efa\u6d4b\u8bd5\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># echo &#034;hello Linux&#034; &gt; source.txt<\/span><\/p>\n<p>\u67e5\u770b\u5185\u5bb9&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat source.txt<\/span><br \/>\nhello Linux<\/p>\n<p>\u590d\u5236\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp source.txt backup.txt<\/span><\/p>\n<p>\u67e5\u770b\u7ed3\u679c&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ls -l<\/span><br \/>\n-rw-r&#8211;r&#8211; <span class=\"token number\">1<\/span> root root <span class=\"token number\">12<\/span> Jul <span class=\"token number\">31<\/span> <span class=\"token number\">20<\/span>:10 backup.txt<br \/>\n-rw-r&#8211;r&#8211; <span class=\"token number\">1<\/span> root root <span class=\"token number\">12<\/span> Jul <span class=\"token number\">31<\/span> <span class=\"token number\">20<\/span>:10 source.txt<\/p>\n<p>\u67e5\u770b\u526f\u672c\u5185\u5bb9&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat backup.txt<\/span><br \/>\nhello Linux<\/p>\n<p>\u6b64\u65f6&#xff1a;<\/p>\n<p>source.txt&#xff1a;\u539f\u6587\u4ef6<br \/>\nbackup.txt&#xff1a;\u65b0\u590d\u5236\u51fa\u7684\u72ec\u7acb\u6587\u4ef6<\/p>\n<p>\u4fee\u6539\u5176\u4e2d\u4e00\u4e2a\u6587\u4ef6&#xff0c;\u4e0d\u4f1a\u76f4\u63a5\u4fee\u6539\u53e6\u4e00\u4e2a\u6587\u4ef6\u3002<\/p>\n<h4>3.3 \u590d\u5236\u5230\u6307\u5b9a\u76ee\u5f55<\/h4>\n<p>\u521b\u5efa\u76ee\u5f55&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mkdir backup<\/span><\/p>\n<p>\u590d\u5236\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp source.txt backup\/<\/span><\/p>\n<p>\u67e5\u770b&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ls backup<\/span><br \/>\nsource.txt<\/p>\n<p>\u6587\u4ef6\u540d\u6ca1\u6709\u6539\u53d8&#xff0c;\u53ea\u662f\u590d\u5236\u5230\u4e86\u53e6\u4e00\u4e2a\u76ee\u5f55\u3002<\/p>\n<h4>3.4 \u590d\u5236\u65f6\u4fee\u6539\u6587\u4ef6\u540d<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp source.txt backup\/source_copy.txt<\/span><\/p>\n<p>\u67e5\u770b&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ls backup<\/span><br \/>\nsource.txt  source_copy.txt<\/p>\n<p>\u590d\u5236\u548c\u91cd\u547d\u540d\u53ef\u4ee5\u5728\u540c\u4e00\u6b65\u5b8c\u6210\u3002<\/p>\n<h4>3.5 \u4e00\u6b21\u590d\u5236\u591a\u4e2a\u6587\u4ef6<\/h4>\n<p>\u521b\u5efa\u51e0\u4e2a\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># touch main.cpp test.cpp README.md<\/span><\/p>\n<p>\u5168\u90e8\u590d\u5236\u5230 backup&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp main.cpp test.cpp README.md backup\/<\/span><\/p>\n<h4>3.6 \u4f7f\u7528\u901a\u914d\u7b26\u590d\u5236<\/h4>\n<p>\u590d\u5236\u6240\u6709 .cpp \u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp *.cpp backup\/<\/span><\/p>\n<p>\u8fd9\u91cc\u7684&#xff1a;<\/p>\n<p>*<\/p>\n<p>\u662f Shell \u901a\u914d\u7b26&#xff0c;\u8868\u793a\u5339\u914d\u4efb\u610f\u957f\u5ea6\u7684\u5b57\u7b26\u3002<\/p>\n<p>\u56e0\u6b64&#xff1a;<\/p>\n<p>*.cpp<\/p>\n<p>\u53ef\u4ee5\u5339\u914d&#xff1a;<\/p>\n<p>main.cpp<br \/>\ntest.cpp<br \/>\nserver.cpp<\/p>\n<p>\u4f46\u4e0d\u4f1a\u5339\u914d&#xff1a;<\/p>\n<p>README.md<br \/>\nmain.c<\/p>\n<p>\u9700\u8981\u6ce8\u610f&#xff0c;\u901a\u914d\u7b26\u901a\u5e38\u7531 Shell \u5148\u5c55\u5f00&#xff0c;\u518d\u628a\u5c55\u5f00\u540e\u7684\u6587\u4ef6\u540d\u4ea4\u7ed9 cp\u3002<\/p>\n<p>\u53ef\u4ee5\u5148\u4f7f\u7528&#xff1a;<\/p>\n<p><span class=\"token function\">ls<\/span> *.cpp<\/p>\n<p>\u786e\u8ba4\u5339\u914d\u7ed3\u679c&#xff0c;\u518d\u6267\u884c\u590d\u5236\u3002<\/p>\n<h4>3.7 \u8986\u76d6\u76ee\u6807\u6587\u4ef6<\/h4>\n<p>\u5982\u679c\u76ee\u6807\u6587\u4ef6\u5df2\u7ecf\u5b58\u5728&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp source.txt backup.txt<\/span><\/p>\n<p>\u901a\u5e38\u4f1a\u76f4\u63a5\u8986\u76d6\u539f\u6765\u7684 backup.txt\u3002<\/p>\n<p>\u4e3a\u4e86\u907f\u514d\u65e0\u610f\u8986\u76d6&#xff0c;\u53ef\u4ee5\u4f7f\u7528&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp -i source.txt backup.txt<\/span><br \/>\ncp: overwrite <span class=\"token string\">&#039;backup.txt&#039;<\/span>? <\/p>\n<p>\u8f93\u5165 y \u624d\u4f1a\u8986\u76d6\u3002<\/p>\n<h4>3.8 \u9012\u5f52\u590d\u5236\u76ee\u5f55<\/h4>\n<p>\u666e\u901a cp \u4e0d\u80fd\u76f4\u63a5\u590d\u5236\u76ee\u5f55&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp project project_backup<\/span><br \/>\ncp: <span class=\"token parameter variable\">-r<\/span> not specified<span class=\"token punctuation\">;<\/span> omitting directory <span class=\"token string\">&#039;project&#039;<\/span><\/p>\n<p>\u590d\u5236\u76ee\u5f55\u9700\u8981\u4f7f\u7528 -r&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp -r project project_backup<\/span><\/p>\n<p>\u5982\u679c project_backup \u4e0d\u5b58\u5728&#xff0c;\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u76ee\u5f55\u526f\u672c\u3002<\/p>\n<p>\u53ef\u4ee5\u67e5\u770b&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># tree project_backup<\/span><br \/>\nproject_backup<br \/>\n\u2514\u2500\u2500 src<br \/>\n    \u2514\u2500\u2500 main.cpp<\/p>\n<h4>3.9 \u4f7f\u7528\u5f52\u6863\u6a21\u5f0f\u590d\u5236<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp -a project project_backup<\/span><\/p>\n<p>-a \u53ef\u4ee5\u7406\u89e3\u4e3a\u5f52\u6863\u590d\u5236&#xff0c;\u9002\u5408\u5b8c\u6574\u590d\u5236\u76ee\u5f55\u7ed3\u6784\u3002<\/p>\n<p>\u5b83\u4f1a\u5c3d\u91cf\u4fdd\u7559&#xff1a;<\/p>\n<p>\u6743\u9650<br \/>\n\u65f6\u95f4\u6233<br \/>\n\u7b26\u53f7\u94fe\u63a5<br \/>\n\u76ee\u5f55\u7ed3\u6784<br \/>\n\u6587\u4ef6\u5c5e\u6027<\/p>\n<p>\u666e\u901a\u5b66\u4e60\u573a\u666f\u4e2d&#xff1a;<\/p>\n<p>cp -r&#xff1a;\u9012\u5f52\u590d\u5236\u76ee\u5f55<br \/>\ncp -a&#xff1a;\u66f4\u5b8c\u6574\u5730\u4fdd\u7559\u6e90\u6587\u4ef6\u5c5e\u6027<\/p>\n<h4>3.10 \u5e38\u7528\u9009\u9879<\/h4>\n<table>\n<tr>\u9009\u9879\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>-i<\/td>\n<td>\u8986\u76d6\u524d\u8be2\u95ee<\/td>\n<\/tr>\n<tr>\n<td>-r\u3001-R<\/td>\n<td>\u9012\u5f52\u590d\u5236\u76ee\u5f55<\/td>\n<\/tr>\n<tr>\n<td>-a<\/td>\n<td>\u5f52\u6863\u590d\u5236&#xff0c;\u5c3d\u91cf\u4fdd\u7559\u5c5e\u6027<\/td>\n<\/tr>\n<tr>\n<td>-f<\/td>\n<td>\u5fc5\u8981\u65f6\u5f3a\u5236\u8986\u76d6\u76ee\u6807<\/td>\n<\/tr>\n<tr>\n<td>-v<\/td>\n<td>\u663e\u793a\u590d\u5236\u8fc7\u7a0b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp -rv project project_backup<\/span><br \/>\n<span class=\"token string\">&#039;project&#039;<\/span> &#8211;<span class=\"token operator\">&gt;<\/span> <span class=\"token string\">&#039;project_backup&#039;<\/span><br \/>\n<span class=\"token string\">&#039;project\/src&#039;<\/span> &#8211;<span class=\"token operator\">&gt;<\/span> <span class=\"token string\">&#039;project_backup\/src&#039;<\/span><br \/>\n<span class=\"token string\">&#039;project\/src\/main.cpp&#039;<\/span> &#8211;<span class=\"token operator\">&gt;<\/span> <span class=\"token string\">&#039;project_backup\/src\/main.cpp&#039;<\/span><\/p>\n<hr \/>\n<h3>\u56db\u3001mv&#xff1a;\u79fb\u52a8\u6587\u4ef6\u3001\u79fb\u52a8\u76ee\u5f55\u548c\u91cd\u547d\u540d<\/h3>\n<p>mv \u662f&#xff1a;<\/p>\n<p>move<\/p>\n<p>\u7684\u7f29\u5199\u3002<\/p>\n<p>\u5b83\u6709\u4e24\u4e2a\u5e38\u89c1\u7528\u9014&#xff1a;<\/p>\n<p>\u79fb\u52a8\u6587\u4ef6\u6216\u76ee\u5f55<br \/>\n\u4fee\u6539\u6587\u4ef6\u6216\u76ee\u5f55\u540d\u79f0<\/p>\n<p>\u8fd9\u4e24\u79cd\u529f\u80fd\u672c\u8d28\u4e0a\u90fd\u662f\u6539\u53d8\u6587\u4ef6\u5728\u76ee\u5f55\u6811\u4e2d\u7684\u4f4d\u7f6e\u6216\u540d\u79f0\u3002<\/p>\n<h4>4.1 \u4fee\u6539\u6587\u4ef6\u540d<\/h4>\n<p>\u521b\u5efa\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># touch old_name.txt<\/span><\/p>\n<p>\u91cd\u547d\u540d&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mv old_name.txt new_name.txt<\/span><\/p>\n<p>\u67e5\u770b&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ls<\/span><br \/>\nnew_name.txt<\/p>\n<p>\u8fd9\u91cc\u6ca1\u6709\u521b\u5efa\u6587\u4ef6\u526f\u672c&#xff0c;\u53ea\u662f\u628a\u539f\u6587\u4ef6\u540d\u79f0\u6539\u4e86\u3002<\/p>\n<h4>4.2 \u79fb\u52a8\u6587\u4ef6\u5230\u53e6\u4e00\u4e2a\u76ee\u5f55<\/h4>\n<p>\u521b\u5efa\u76ee\u5f55&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mkdir documents<\/span><\/p>\n<p>\u79fb\u52a8\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mv new_name.txt documents\/<\/span><\/p>\n<p>\u67e5\u770b&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ls documents<\/span><br \/>\nnew_name.txt<\/p>\n<p>\u539f\u76ee\u5f55\u4e2d\u4e0d\u518d\u4fdd\u7559\u539f\u6587\u4ef6\u3002<\/p>\n<h4>4.3 \u79fb\u52a8\u5e76\u91cd\u547d\u540d<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mv documents\/new_name.txt documents\/note.txt<\/span><\/p>\n<p>\u4e5f\u53ef\u4ee5\u79fb\u52a8\u5230\u5176\u4ed6\u76ee\u5f55\u65f6\u987a\u4fbf\u6539\u540d&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mv documents\/note.txt backup\/note_backup.txt<\/span><\/p>\n<h4>4.4 \u79fb\u52a8\u6574\u4e2a\u76ee\u5f55<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mv project backup\/<\/span><\/p>\n<p>\u4e0e cp \u4e0d\u540c&#xff0c;mv \u79fb\u52a8\u76ee\u5f55\u65f6\u4e0d\u9700\u8981\u6dfb\u52a0 -r\u3002<\/p>\n<p>\u79fb\u52a8\u5b8c\u6210\u540e&#xff0c;\u539f\u4f4d\u7f6e\u4e0d\u518d\u5b58\u5728 project&#xff0c;\u5b83\u4f1a\u51fa\u73b0\u5728&#xff1a;<\/p>\n<p>backup\/project<\/p>\n<h4>4.5 \u76ee\u6807\u6587\u4ef6\u5df2\u5b58\u5728<\/h4>\n<p>\u5982\u679c\u6267\u884c&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mv source.txt backup.txt<\/span><\/p>\n<p>\u5e76\u4e14 backup.txt \u5df2\u5b58\u5728&#xff0c;\u901a\u5e38\u4f1a\u8986\u76d6\u76ee\u6807\u6587\u4ef6\u3002<\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mv -i source.txt backup.txt<\/span><br \/>\nmv: overwrite <span class=\"token string\">&#039;backup.txt&#039;<\/span>?<\/p>\n<p>\u786e\u8ba4\u540e\u624d\u4f1a\u8986\u76d6\u3002<\/p>\n<h4>4.6 \u5e38\u7528\u9009\u9879<\/h4>\n<table>\n<tr>\u9009\u9879\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>-i<\/td>\n<td>\u8986\u76d6\u524d\u8be2\u95ee<\/td>\n<\/tr>\n<tr>\n<td>-f<\/td>\n<td>\u5f3a\u5236\u79fb\u52a8&#xff0c;\u4e0d\u8fdb\u884c\u5e38\u89c4\u8be2\u95ee<\/td>\n<\/tr>\n<tr>\n<td>-n<\/td>\n<td>\u4e0d\u8986\u76d6\u5df2\u7ecf\u5b58\u5728\u7684\u76ee\u6807<\/td>\n<\/tr>\n<tr>\n<td>-v<\/td>\n<td>\u663e\u793a\u79fb\u52a8\u8fc7\u7a0b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mv -v note.txt documents\/<\/span><br \/>\nrenamed <span class=\"token string\">&#039;note.txt&#039;<\/span> &#8211;<span class=\"token operator\">&gt;<\/span> <span class=\"token string\">&#039;documents\/note.txt&#039;<\/span><\/p>\n<h4>4.7 cp \u548c mv \u7684\u533a\u522b<\/h4>\n<table>\n<tr>\u64cd\u4f5ccpmv<\/tr>\n<tbody>\n<tr>\n<td>\u539f\u6587\u4ef6\u662f\u5426\u4fdd\u7559<\/td>\n<td>\u4fdd\u7559<\/td>\n<td>\u901a\u5e38\u4e0d\u4fdd\u7559<\/td>\n<\/tr>\n<tr>\n<td>\u662f\u5426\u751f\u6210\u526f\u672c<\/td>\n<td>\u662f<\/td>\n<td>\u5426<\/td>\n<\/tr>\n<tr>\n<td>\u80fd\u5426\u91cd\u547d\u540d<\/td>\n<td>\u590d\u5236\u65f6\u53ef\u6307\u5b9a\u65b0\u540d\u5b57<\/td>\n<td>\u53ef\u4ee5<\/td>\n<\/tr>\n<tr>\n<td>\u590d\u5236\u76ee\u5f55\u662f\u5426\u9700\u8981 -r<\/td>\n<td>\u9700\u8981<\/td>\n<td>\u4e0d\u9700\u8981<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u4e94\u3001cat&#xff1a;\u67e5\u770b\u548c\u8fde\u63a5\u6587\u672c\u6587\u4ef6<\/h3>\n<p>cat \u662f&#xff1a;<\/p>\n<p>concatenate<\/p>\n<p>\u7684\u7f29\u5199\u3002<\/p>\n<p>\u5b83\u7684\u4e3b\u8981\u529f\u80fd\u5305\u62ec&#xff1a;<\/p>\n<p>\u663e\u793a\u6587\u4ef6\u5185\u5bb9<br \/>\n\u8fde\u63a5\u591a\u4e2a\u6587\u4ef6\u5185\u5bb9<br \/>\n\u914d\u5408\u91cd\u5b9a\u5411\u751f\u6210\u6587\u4ef6<\/p>\n<h4>5.1 \u67e5\u770b\u4e00\u4e2a\u5c0f\u578b\u6587\u672c\u6587\u4ef6<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat source.txt<\/span><br \/>\nhello Linux<\/p>\n<p>cat \u4f1a\u628a\u6587\u4ef6\u5185\u5bb9\u76f4\u63a5\u8f93\u51fa\u5230\u7ec8\u7aef\u3002<\/p>\n<p>\u5b83\u9002\u5408\u67e5\u770b&#xff1a;<\/p>\n<p>\u5185\u5bb9\u8f83\u5c11\u7684\u914d\u7f6e\u6587\u4ef6<br \/>\n\u7b80\u77ed\u7684\u6e90\u4ee3\u7801<br \/>\n\u5c0f\u578b\u65e5\u5fd7<br \/>\n\u7b80\u5355\u6587\u672c<\/p>\n<p>\u5982\u679c\u6587\u4ef6\u6709\u51e0\u5343\u884c&#xff0c;\u76f4\u63a5 cat \u4f1a\u8ba9\u5185\u5bb9\u8fc5\u901f\u6eda\u8fc7\u5c4f\u5e55&#xff0c;\u6b64\u65f6\u66f4\u9002\u5408\u4f7f\u7528\u540e\u9762\u7684 less\u3002<\/p>\n<h4>5.2 \u540c\u65f6\u67e5\u770b\u591a\u4e2a\u6587\u4ef6<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat file1.txt file2.txt<\/span><\/p>\n<p>cat \u4f1a\u6309\u7167\u53c2\u6570\u987a\u5e8f\u4f9d\u6b21\u8f93\u51fa\u4e24\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat file1.txt<\/span><br \/>\nfirst<br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat file2.txt<\/span><br \/>\nsecond<br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat file1.txt file2.txt<\/span><br \/>\nfirst<br \/>\nsecond<\/p>\n<h4>5.3 \u4e3a\u6240\u6709\u8f93\u51fa\u884c\u6dfb\u52a0\u7f16\u53f7<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat -n source.txt<\/span><br \/>\n     <span class=\"token number\">1<\/span>  hello Linux<\/p>\n<p>-n \u4f1a\u7ed9\u6240\u6709\u8f93\u51fa\u884c\u7f16\u53f7&#xff0c;\u5305\u62ec\u7a7a\u884c\u3002<\/p>\n<h4>5.4 \u53ea\u7ed9\u975e\u7a7a\u884c\u7f16\u53f7<\/h4>\n<p>\u5047\u8bbe\u6587\u4ef6\u5185\u5bb9\u4e3a&#xff1a;<\/p>\n<p>first<\/p>\n<p>second<\/p>\n<p>\u6267\u884c&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat -b text.txt<\/span><br \/>\n     <span class=\"token number\">1<\/span>  first<\/p>\n<p>     <span class=\"token number\">2<\/span>  second<\/p>\n<p>-b \u53ea\u7ed9\u975e\u7a7a\u884c\u7f16\u53f7\u3002<\/p>\n<h4>5.5 \u538b\u7f29\u8fde\u7eed\u7a7a\u884c<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat -s text.txt<\/span><\/p>\n<p>-s \u4f1a\u628a\u591a\u884c\u8fde\u7eed\u7a7a\u884c\u538b\u7f29\u6210\u4e00\u884c\u7a7a\u884c\u3002<\/p>\n<p>\u9700\u8981\u6ce8\u610f&#xff0c;\u5b83\u4e0d\u4f1a\u5220\u9664\u5168\u90e8\u7a7a\u884c&#xff0c;\u53ea\u4f1a\u628a\u8fde\u7eed\u7684\u591a\u4e2a\u7a7a\u884c\u5408\u5e76\u3002<\/p>\n<h4>5.6 \u5e38\u7528\u9009\u9879<\/h4>\n<table>\n<tr>\u9009\u9879\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>-n<\/td>\n<td>\u4e3a\u6240\u6709\u8f93\u51fa\u884c\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>-b<\/td>\n<td>\u53ea\u4e3a\u975e\u7a7a\u884c\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>-s<\/td>\n<td>\u538b\u7f29\u8fde\u7eed\u7a7a\u884c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>5.7 cat \u4e0d\u9002\u5408\u7f16\u8f91\u6587\u4ef6<\/h4>\n<p>cat \u53ef\u4ee5\u67e5\u770b\u6587\u4ef6&#xff0c;\u4f46\u5b83\u4e0d\u662f\u6587\u672c\u7f16\u8f91\u5668\u3002<\/p>\n<p>\u7f16\u8f91\u6587\u4ef6\u901a\u5e38\u9700\u8981\u4f7f\u7528&#xff1a;<\/p>\n<p>vim<br \/>\nnano<br \/>\n\u5176\u4ed6\u7f16\u8f91\u5668<\/p>\n<p>\u540e\u7eed\u5b66\u4e60 Vim \u65f6&#xff0c;\u518d\u4e13\u95e8\u8bb2\u89e3\u7ec8\u7aef\u4e2d\u7684\u6587\u672c\u7f16\u8f91\u3002<\/p>\n<hr \/>\n<h3>\u516d\u3001\u91cd\u5b9a\u5411&#xff1a;\u628a\u8f93\u51fa\u5199\u5165\u6587\u4ef6<\/h3>\n<p>\u524d\u9762\u7684\u793a\u4f8b\u4e2d\u4f7f\u7528\u8fc7&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;hello Linux&#034;<\/span> <span class=\"token operator\">&gt;<\/span> source.txt<\/p>\n<p>\u8fd9\u91cc\u7684&#xff1a;<\/p>\n<p>&gt;<\/p>\n<p>\u53eb\u505a\u8f93\u51fa\u91cd\u5b9a\u5411\u7b26\u53f7\u3002<\/p>\n<h4>6.1 \u6807\u51c6\u8f93\u51fa<\/h4>\n<p>\u547d\u4ee4\u9ed8\u8ba4\u4f1a\u628a\u7ed3\u679c\u663e\u793a\u5728\u7ec8\u7aef\u4e2d&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># echo &#034;hello Linux&#034;<\/span><br \/>\nhello Linux<\/p>\n<p>\u628a\u8f93\u51fa\u91cd\u5b9a\u5411\u5230\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># echo &#034;hello Linux&#034; &gt; output.txt<\/span><\/p>\n<p>\u7ec8\u7aef\u4e2d\u4e0d\u518d\u663e\u793a hello Linux&#xff0c;\u5185\u5bb9\u88ab\u5199\u8fdb\u4e86\u6587\u4ef6\u3002<\/p>\n<p>\u67e5\u770b&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat output.txt<\/span><br \/>\nhello Linux<\/p>\n<h4>6.2 &gt; \u4f1a\u8986\u76d6\u539f\u6587\u4ef6<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># echo &#034;first&#034; &gt; output.txt<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># echo &#034;second&#034; &gt; output.txt<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat output.txt<\/span><br \/>\nsecond<\/p>\n<p>\u7b2c\u4e8c\u6b21\u4f7f\u7528 &gt; \u65f6&#xff0c;\u539f\u6765\u7684 first \u88ab\u8986\u76d6\u3002<\/p>\n<h4>6.3 &gt;&gt; \u4f1a\u8ffd\u52a0\u5185\u5bb9<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># echo &#034;first&#034; &gt; output.txt<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># echo &#034;second&#034; &gt;&gt; output.txt<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat output.txt<\/span><br \/>\nfirst<br \/>\nsecond<\/p>\n<p>\u533a\u522b\u53ef\u4ee5\u6982\u62ec\u4e3a&#xff1a;<\/p>\n<p>&gt;  \u8986\u76d6\u5199\u5165<br \/>\n&gt;&gt; \u8ffd\u52a0\u5199\u5165<\/p>\n<h4>6.4 \u4f7f\u7528\u5faa\u73af\u751f\u6210\u6d4b\u8bd5\u6587\u4ef6<\/h4>\n<p>\u4e0b\u9762\u751f\u6210 200 \u884c\u6d4b\u8bd5\u6570\u636e&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># for i in $(seq 1 200); do echo &#034;line $i&#034;; done &gt; lines.txt<\/span><\/p>\n<p>\u67e5\u770b\u884c\u6570&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># wc -l lines.txt<\/span><br \/>\n<span class=\"token number\">200<\/span> lines.txt<\/p>\n<p>\u8fd9\u4efd\u6587\u4ef6\u53ef\u4ee5\u7528\u4e8e\u6d4b\u8bd5 more\u3001less\u3001head \u548c tail\u3002<\/p>\n<hr \/>\n<h3>\u4e03\u3001more&#xff1a;\u5206\u9875\u67e5\u770b\u6587\u4ef6<\/h3>\n<p>\u5f53\u6587\u4ef6\u5185\u5bb9\u5f88\u591a\u65f6&#xff0c;\u76f4\u63a5\u4f7f\u7528&#xff1a;<\/p>\n<p><span class=\"token function\">cat<\/span> lines.txt<\/p>\n<p>\u5185\u5bb9\u4f1a\u8fc5\u901f\u6eda\u52a8\u8fc7\u53bb\u3002<\/p>\n<p>more \u53ef\u4ee5\u5206\u9875\u663e\u793a\u6587\u672c\u3002<\/p>\n<h4>7.1 \u57fa\u672c\u8bed\u6cd5<\/h4>\n<p><span class=\"token function\">more<\/span> <span class=\"token punctuation\">[<\/span>\u9009\u9879<span class=\"token punctuation\">]<\/span> \u6587\u4ef6<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># more lines.txt<\/span><\/p>\n<p>\u663e\u793a\u4e00\u9875\u540e&#xff0c;\u5e95\u90e8\u53ef\u80fd\u51fa\u73b0&#xff1a;<\/p>\n<p>&#8211;More&#8211;(10%)<\/p>\n<h4>7.2 \u5e38\u7528\u64cd\u4f5c<\/h4>\n<table>\n<tr>\u6309\u952e\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>Space<\/td>\n<td>\u5411\u4e0b\u7ffb\u4e00\u9875<\/td>\n<\/tr>\n<tr>\n<td>Enter<\/td>\n<td>\u5411\u4e0b\u79fb\u52a8\u4e00\u884c<\/td>\n<\/tr>\n<tr>\n<td>b<\/td>\n<td>\u5c1d\u8bd5\u5411\u4e0a\u7ffb\u4e00\u9875<\/td>\n<\/tr>\n<tr>\n<td>\/\u5173\u952e\u5b57<\/td>\n<td>\u641c\u7d22\u5173\u952e\u5b57<\/td>\n<\/tr>\n<tr>\n<td>q<\/td>\n<td>\u9000\u51fa<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0d\u540c\u7cfb\u7edf\u4e2d\u7684 more \u529f\u80fd\u53ef\u80fd\u5b58\u5728\u4e00\u5b9a\u5dee\u5f02\u3002<\/p>\n<h4>7.3 \u6307\u5b9a\u6bcf\u9875\u663e\u793a\u884c\u6570<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># more -10 lines.txt<\/span><\/p>\n<p>\u8868\u793a\u6bcf\u6b21\u6309\u6307\u5b9a\u884c\u6570\u5206\u9875\u663e\u793a\u3002<\/p>\n<h4>7.4 more \u7684\u5c40\u9650<\/h4>\n<p>more \u7684\u529f\u80fd\u6bd4\u8f83\u57fa\u7840&#xff0c;\u5411\u524d\u7ffb\u9875\u3001\u641c\u7d22\u548c\u4ea4\u4e92\u80fd\u529b\u4e0d\u5982 less \u7075\u6d3b\u3002<\/p>\n<p>\u5b9e\u9645\u4f7f\u7528\u4e2d&#xff0c;\u66f4\u63a8\u8350&#xff1a;<\/p>\n<p><span class=\"token function\">less<\/span> \u6587\u4ef6\u540d<\/p>\n<hr \/>\n<h3>\u516b\u3001less&#xff1a;\u66f4\u7075\u6d3b\u5730\u6d4f\u89c8\u957f\u6587\u672c<\/h3>\n<p>less \u548c more \u90fd\u7528\u4e8e\u5206\u9875\u67e5\u770b\u6587\u672c&#xff0c;\u4f46 less \u7684\u529f\u80fd\u66f4\u5b8c\u6574\u3002<\/p>\n<p>\u5b83\u652f\u6301&#xff1a;<\/p>\n<p>\u5411\u524d\u7ffb\u9875<br \/>\n\u5411\u540e\u7ffb\u9875<br \/>\n\u4e0a\u4e0b\u641c\u7d22<br \/>\n\u663e\u793a\u884c\u53f7<br \/>\n\u76f4\u63a5\u8df3\u8f6c<br \/>\n\u4e0d\u5fc5\u4e00\u6b21\u52a0\u8f7d\u5b8c\u6574\u6587\u4ef6<\/p>\n<h4>8.1 \u57fa\u672c\u8bed\u6cd5<\/h4>\n<p><span class=\"token function\">less<\/span> <span class=\"token punctuation\">[<\/span>\u9009\u9879<span class=\"token punctuation\">]<\/span> \u6587\u4ef6<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># less lines.txt<\/span><\/p>\n<h4>8.2 \u5e38\u7528\u6309\u952e<\/h4>\n<table>\n<tr>\u6309\u952e\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>Space\u3001PageDown<\/td>\n<td>\u5411\u4e0b\u7ffb\u9875<\/td>\n<\/tr>\n<tr>\n<td>b\u3001PageUp<\/td>\n<td>\u5411\u4e0a\u7ffb\u9875<\/td>\n<\/tr>\n<tr>\n<td>j\u3001\u65b9\u5411\u952e\u4e0b<\/td>\n<td>\u5411\u4e0b\u79fb\u52a8\u4e00\u884c<\/td>\n<\/tr>\n<tr>\n<td>k\u3001\u65b9\u5411\u952e\u4e0a<\/td>\n<td>\u5411\u4e0a\u79fb\u52a8\u4e00\u884c<\/td>\n<\/tr>\n<tr>\n<td>g<\/td>\n<td>\u8df3\u5230\u6587\u4ef6\u5f00\u5934<\/td>\n<\/tr>\n<tr>\n<td>G<\/td>\n<td>\u8df3\u5230\u6587\u4ef6\u672b\u5c3e<\/td>\n<\/tr>\n<tr>\n<td>\/\u5b57\u7b26\u4e32<\/td>\n<td>\u5411\u4e0b\u641c\u7d22<\/td>\n<\/tr>\n<tr>\n<td>?\u5b57\u7b26\u4e32<\/td>\n<td>\u5411\u4e0a\u641c\u7d22<\/td>\n<\/tr>\n<tr>\n<td>n<\/td>\n<td>\u91cd\u590d\u4e0a\u4e00\u6b21\u641c\u7d22\u65b9\u5411<\/td>\n<\/tr>\n<tr>\n<td>N<\/td>\n<td>\u53cd\u5411\u91cd\u590d\u641c\u7d22<\/td>\n<\/tr>\n<tr>\n<td>q<\/td>\n<td>\u9000\u51fa<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>8.3 \u663e\u793a\u884c\u53f7<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># less -N lines.txt<\/span><\/p>\n<p>-N \u4f1a\u5728\u5de6\u4fa7\u663e\u793a\u884c\u53f7\u3002<\/p>\n<h4>8.4 \u641c\u7d22\u65f6\u5ffd\u7565\u5927\u5c0f\u5199<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># less -i application.log<\/span><\/p>\n<p>-i \u53ef\u4ee5\u5728\u641c\u7d22\u65f6\u5ffd\u7565\u5927\u5c0f\u5199&#xff0c;\u4f46\u5177\u4f53\u884c\u4e3a\u8fd8\u4f1a\u53d7\u5230\u641c\u7d22\u5185\u5bb9\u5f71\u54cd\u3002<\/p>\n<h4>8.5 more \u548c less \u5bf9\u6bd4<\/h4>\n<table>\n<tr>\u5bf9\u6bd4\u9879moreless<\/tr>\n<tbody>\n<tr>\n<td>\u5411\u4e0b\u6d4f\u89c8<\/td>\n<td>\u652f\u6301<\/td>\n<td>\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td>\u5411\u4e0a\u6d4f\u89c8<\/td>\n<td>\u80fd\u529b\u6709\u9650<\/td>\n<td>\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td>\u641c\u7d22<\/td>\n<td>\u57fa\u7840\u652f\u6301<\/td>\n<td>\u652f\u6301\u4e0a\u4e0b\u641c\u7d22<\/td>\n<\/tr>\n<tr>\n<td>\u8df3\u5230\u5f00\u5934\u548c\u672b\u5c3e<\/td>\n<td>\u80fd\u529b\u8f83\u5f31<\/td>\n<td>\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td>\u5927\u6587\u4ef6\u67e5\u770b<\/td>\n<td>\u53ef\u4ee5<\/td>\n<td>\u66f4\u9002\u5408<\/td>\n<\/tr>\n<tr>\n<td>\u5b9e\u9645\u4f7f\u7528\u9891\u7387<\/td>\n<td>\u8f83\u4f4e<\/td>\n<td>\u8f83\u9ad8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u53ef\u4ee5\u7528\u4e00\u53e5\u5e38\u89c1\u7684\u8bdd\u8bb0\u5fc6&#xff1a;<\/p>\n<p>less is more<\/p>\n<p>\u4e5f\u5c31\u662f less \u867d\u7136\u540d\u5b57\u53eb\u201c\u66f4\u5c11\u201d&#xff0c;\u529f\u80fd\u901a\u5e38\u6bd4 more \u66f4\u591a\u3002<\/p>\n<hr \/>\n<h3>\u4e5d\u3001head&#xff1a;\u67e5\u770b\u6587\u4ef6\u5f00\u5934<\/h3>\n<p>head \u7528\u4e8e\u67e5\u770b\u6587\u4ef6\u5f00\u5934\u7684\u5185\u5bb9\u3002<\/p>\n<h4>9.1 \u57fa\u672c\u8bed\u6cd5<\/h4>\n<p><span class=\"token function\">head<\/span> <span class=\"token punctuation\">[<\/span>\u9009\u9879<span class=\"token punctuation\">]<\/span> \u6587\u4ef6<\/p>\n<p>\u9ed8\u8ba4\u663e\u793a\u524d 10 \u884c&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># head lines.txt<\/span><br \/>\nline <span class=\"token number\">1<\/span><br \/>\nline <span class=\"token number\">2<\/span><br \/>\nline <span class=\"token number\">3<\/span><br \/>\nline <span class=\"token number\">4<\/span><br \/>\nline <span class=\"token number\">5<\/span><br \/>\nline <span class=\"token number\">6<\/span><br \/>\nline <span class=\"token number\">7<\/span><br \/>\nline <span class=\"token number\">8<\/span><br \/>\nline <span class=\"token number\">9<\/span><br \/>\nline <span class=\"token number\">10<\/span><\/p>\n<h4>9.2 \u6307\u5b9a\u663e\u793a\u884c\u6570<\/h4>\n<p>\u663e\u793a\u524d 5 \u884c&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># head -n 5 lines.txt<\/span><br \/>\nline <span class=\"token number\">1<\/span><br \/>\nline <span class=\"token number\">2<\/span><br \/>\nline <span class=\"token number\">3<\/span><br \/>\nline <span class=\"token number\">4<\/span><br \/>\nline <span class=\"token number\">5<\/span><\/p>\n<p>\u5728 GNU\/Linux \u4e2d\u4e5f\u7ecf\u5e38\u5199\u6210&#xff1a;<\/p>\n<p><span class=\"token function\">head<\/span> <span class=\"token parameter variable\">-5<\/span> lines.txt<\/p>\n<p>\u4e0d\u8fc7\u5b8c\u6574\u5199\u6cd5&#xff1a;<\/p>\n<p><span class=\"token function\">head<\/span> <span class=\"token parameter variable\">-n<\/span> <span class=\"token number\">5<\/span> lines.txt<\/p>\n<p>\u8bed\u4e49\u66f4\u52a0\u660e\u786e\u3002<\/p>\n<h4>9.3 \u5e38\u89c1\u4f7f\u7528\u573a\u666f<\/h4>\n<p>head \u5e38\u7528\u4e8e&#xff1a;<\/p>\n<p>\u5feb\u901f\u68c0\u67e5\u6570\u636e\u6587\u4ef6\u683c\u5f0f<br \/>\n\u67e5\u770b CSV \u6587\u4ef6\u8868\u5934<br \/>\n\u786e\u8ba4\u65e5\u5fd7\u5f00\u5934<br \/>\n\u62bd\u6837\u67e5\u770b\u547d\u4ee4\u8f93\u51fa<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># head -n 3 users.csv<\/span><br \/>\nid,name,age<br \/>\n<span class=\"token number\">1<\/span>,Alice,20<br \/>\n<span class=\"token number\">2<\/span>,Bob,21<\/p>\n<hr \/>\n<h3>\u5341\u3001tail&#xff1a;\u67e5\u770b\u6587\u4ef6\u7ed3\u5c3e\u548c\u8ddf\u8e2a\u65e5\u5fd7<\/h3>\n<p>tail \u7528\u4e8e\u67e5\u770b\u6587\u4ef6\u672b\u5c3e\u5185\u5bb9\u3002<\/p>\n<h4>10.1 \u9ed8\u8ba4\u67e5\u770b\u6700\u540e 10 \u884c<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># tail lines.txt<\/span><br \/>\nline <span class=\"token number\">191<\/span><br \/>\nline <span class=\"token number\">192<\/span><br \/>\nline <span class=\"token number\">193<\/span><br \/>\nline <span class=\"token number\">194<\/span><br \/>\nline <span class=\"token number\">195<\/span><br \/>\nline <span class=\"token number\">196<\/span><br \/>\nline <span class=\"token number\">197<\/span><br \/>\nline <span class=\"token number\">198<\/span><br \/>\nline <span class=\"token number\">199<\/span><br \/>\nline <span class=\"token number\">200<\/span><\/p>\n<h4>10.2 \u6307\u5b9a\u663e\u793a\u884c\u6570<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># tail -n 3 lines.txt<\/span><br \/>\nline <span class=\"token number\">198<\/span><br \/>\nline <span class=\"token number\">199<\/span><br \/>\nline <span class=\"token number\">200<\/span><\/p>\n<p>\u4e5f\u53ef\u4ee5\u7b80\u5199\u6210&#xff1a;<\/p>\n<p><span class=\"token function\">tail<\/span> <span class=\"token parameter variable\">-3<\/span> lines.txt<\/p>\n<h4>10.3 \u5b9e\u65f6\u8ddf\u8e2a\u65e5\u5fd7<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># tail -f application.log<\/span><\/p>\n<p>-f \u4f1a\u6301\u7eed\u7b49\u5f85\u6587\u4ef6\u65b0\u589e\u5185\u5bb9\u3002<\/p>\n<p>\u5f53\u53e6\u4e00\u4e2a\u7a0b\u5e8f\u7ee7\u7eed\u5411\u65e5\u5fd7\u4e2d\u5199\u5165\u6570\u636e\u65f6&#xff0c;\u7ec8\u7aef\u4f1a\u5b9e\u65f6\u663e\u793a\u65b0\u589e\u884c\u3002<\/p>\n<p>\u9000\u51fa\u8ddf\u8e2a&#xff1a;<\/p>\n<p>Ctrl &#043; C<\/p>\n<h4>10.4 \u6a21\u62df\u52a8\u6001\u65e5\u5fd7<\/h4>\n<p>\u7ec8\u7aef\u4e00&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># touch application.log<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># tail -f application.log<\/span><\/p>\n<p>\u7ec8\u7aef\u4e8c&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># echo &#034;server started&#034; &gt;&gt; application.log<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># echo &#034;new request&#034; &gt;&gt; application.log<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># echo &#034;request finished&#034; &gt;&gt; application.log<\/span><\/p>\n<p>\u7ec8\u7aef\u4e00\u4f1a\u4f9d\u6b21\u663e\u793a&#xff1a;<\/p>\n<p>server started<br \/>\nnew request<br \/>\nrequest finished<\/p>\n<h4>10.5 tail -F<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># tail -F application.log<\/span><\/p>\n<p>-F \u9664\u4e86\u6301\u7eed\u8ddf\u8e2a&#xff0c;\u8fd8\u4f1a\u5728\u65e5\u5fd7\u88ab\u8f6e\u8f6c\u6216\u91cd\u65b0\u521b\u5efa\u540e\u5c1d\u8bd5\u91cd\u65b0\u6253\u5f00\u6587\u4ef6\u3002<\/p>\n<p>\u56e0\u6b64\u5728\u957f\u671f\u8ddf\u8e2a\u670d\u52a1\u65e5\u5fd7\u65f6&#xff0c;tail -F \u5f80\u5f80\u6bd4 tail -f \u66f4\u7a33\u59a5\u3002<\/p>\n<h4>10.6 head \u548c tail \u5bf9\u6bd4<\/h4>\n<p>head&#xff1a;\u67e5\u770b\u5f00\u5934<br \/>\ntail&#xff1a;\u67e5\u770b\u7ed3\u5c3e<\/p>\n<p>\u5b83\u4eec\u90fd\u9ed8\u8ba4\u663e\u793a 10 \u884c&#xff0c;\u4e5f\u90fd\u53ef\u4ee5\u4f7f\u7528&#xff1a;<\/p>\n<p><span class=\"token parameter variable\">-n<\/span> \u884c\u6570<\/p>\n<p>\u6307\u5b9a\u8f93\u51fa\u6570\u91cf\u3002<\/p>\n<hr \/>\n<h3>\u5341\u4e00\u3001\u7ba1\u9053&#xff1a;\u628a\u4e00\u4e2a\u547d\u4ee4\u7684\u8f93\u51fa\u4ea4\u7ed9\u53e6\u4e00\u4e2a\u547d\u4ee4<\/h3>\n<p>\u7ba1\u9053\u7b26\u53f7\u662f&#xff1a;<\/p>\n<p>|<\/p>\n<p>\u5b83\u4f1a\u628a\u5de6\u4fa7\u547d\u4ee4\u7684\u6807\u51c6\u8f93\u51fa&#xff0c;\u4f5c\u4e3a\u53f3\u4fa7\u547d\u4ee4\u7684\u6807\u51c6\u8f93\u5165\u3002<\/p>\n<p>\u57fa\u672c\u7ed3\u6784&#xff1a;<\/p>\n<p>\u547d\u4ee41 <span class=\"token operator\">|<\/span> \u547d\u4ee42<\/p>\n<p>\u6570\u636e\u6d41\u53ef\u4ee5\u8868\u793a\u4e3a&#xff1a;<\/p>\n<p>\u547d\u4ee41<br \/>\n  \u2193 \u6807\u51c6\u8f93\u51fa<br \/>\n\u7ba1\u9053 |<br \/>\n  \u2193 \u6807\u51c6\u8f93\u5165<br \/>\n\u547d\u4ee42<\/p>\n<h4>11.1 \u67e5\u770b\u67d0\u4e00\u6bb5\u884c<\/h4>\n<p>\u5047\u8bbe\u8981\u67e5\u770b lines.txt \u7684\u7b2c 180&#xff5e;200 \u884c&#xff0c;\u5171 21 \u884c\u3002<\/p>\n<p>\u5148\u53d6\u524d 200 \u884c&#xff1a;<\/p>\n<p><span class=\"token function\">head<\/span> <span class=\"token parameter variable\">-n<\/span> <span class=\"token number\">200<\/span> lines.txt<\/p>\n<p>\u518d\u4ece\u8fd9\u4e9b\u7ed3\u679c\u4e2d\u53d6\u6700\u540e 21 \u884c&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># head -n 200 lines.txt | tail -n 21<\/span><br \/>\nline <span class=\"token number\">180<\/span><br \/>\nline <span class=\"token number\">181<\/span><br \/>\nline <span class=\"token number\">182<\/span><br \/>\n<span class=\"token punctuation\">..<\/span>.<br \/>\nline <span class=\"token number\">200<\/span><\/p>\n<p>\u5b8c\u6574\u903b\u8f91\u662f&#xff1a;<\/p>\n<p>head \u53d6\u51fa\u7b2c 1&#xff5e;200 \u884c<br \/>\n             \u2193<br \/>\ntail \u4ece\u4e2d\u53d6\u6700\u540e 21 \u884c<br \/>\n             \u2193<br \/>\n\u5f97\u5230\u7b2c 180&#xff5e;200 \u884c<\/p>\n<p>\u8fd9\u91cc\u5f88\u5bb9\u6613\u53d1\u751f\u5c11\u4e00\u884c\u7684\u95ee\u9898\u3002<\/p>\n<p>\u95ed\u533a\u95f4&#xff1a;<\/p>\n<p>[180, 200]<\/p>\n<p>\u5305\u542b\u7684\u884c\u6570\u662f&#xff1a;<\/p>\n<p>200 &#8211; 180 &#043; 1 &#061; 21<\/p>\n<p>\u6240\u4ee5\u5e94\u8be5\u4f7f\u7528&#xff1a;<\/p>\n<p><span class=\"token function\">tail<\/span> <span class=\"token parameter variable\">-n<\/span> <span class=\"token number\">21<\/span><\/p>\n<p>\u800c\u4e0d\u662f tail -n 20\u3002<\/p>\n<h4>11.2 \u7edf\u8ba1\u76ee\u5f55\u4e2d\u7684\u524d\u51e0\u9879<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ls -l | head -n 5<\/span><\/p>\n<p>\u5148\u7531 ls -l \u751f\u6210\u8be6\u7ec6\u5217\u8868&#xff0c;\u518d\u7531 head \u53ea\u4fdd\u7559\u524d 5 \u884c\u3002<\/p>\n<h4>11.3 \u5728\u8f93\u51fa\u4e2d\u641c\u7d22<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ls -al | grep &#039;\\\\.txt$&#039;<\/span><\/p>\n<p>\u5de6\u8fb9\u5217\u51fa\u6587\u4ef6&#xff0c;\u53f3\u8fb9\u7b5b\u9009\u4ee5 .txt \u7ed3\u5c3e\u7684\u7ed3\u679c\u3002<\/p>\n<p>grep \u4f1a\u5728\u540e\u7eed\u5185\u5bb9\u4e2d\u5355\u72ec\u8bb2\u89e3\u3002<\/p>\n<h4>11.4 \u7ba1\u9053\u548c\u91cd\u5b9a\u5411\u7684\u533a\u522b<\/h4>\n<p>&gt;\u3001&gt;&gt;&#xff1a;\u628a\u8f93\u51fa\u5199\u5165\u6587\u4ef6<br \/>\n|     &#xff1a;\u628a\u8f93\u51fa\u4ea4\u7ed9\u53e6\u4e00\u4e2a\u547d\u4ee4<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p><span class=\"token function\">ls<\/span> <span class=\"token parameter variable\">-al<\/span> <span class=\"token operator\">&gt;<\/span> files.txt<\/p>\n<p>\u8868\u793a\u628a\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6\u3002<\/p>\n<p>\u800c&#xff1a;<\/p>\n<p><span class=\"token function\">ls<\/span> <span class=\"token parameter variable\">-al<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">less<\/span><\/p>\n<p>\u8868\u793a\u628a\u7ed3\u679c\u4ea4\u7ed9 less \u5206\u9875\u67e5\u770b\u3002<\/p>\n<hr \/>\n<h3>\u5341\u4e8c\u3001date&#xff1a;\u67e5\u770b\u548c\u683c\u5f0f\u5316\u65f6\u95f4<\/h3>\n<p>date \u7528\u4e8e\u663e\u793a\u6216\u8bbe\u7f6e\u7cfb\u7edf\u65e5\u671f\u548c\u65f6\u95f4\u3002<\/p>\n<p>\u65e5\u5e38\u4f7f\u7528\u4e2d\u6700\u5e38\u89c1\u7684\u662f\u67e5\u770b\u548c\u683c\u5f0f\u5316\u65f6\u95f4\u3002<\/p>\n<h4>12.1 \u67e5\u770b\u5f53\u524d\u65f6\u95f4<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># date<\/span><br \/>\nFri Jul <span class=\"token number\">31<\/span> <span class=\"token number\">21<\/span>:00:00 CST <span class=\"token number\">2026<\/span><\/p>\n<p>\u5b9e\u9645\u8f93\u51fa\u683c\u5f0f\u4f1a\u53d7\u5230&#xff1a;<\/p>\n<p>\u7cfb\u7edf\u8bed\u8a00<br \/>\n\u65f6\u533a<br \/>\n\u53d1\u884c\u7248<br \/>\n\u73af\u5883\u53d8\u91cf<\/p>\n<p>\u7b49\u56e0\u7d20\u5f71\u54cd\u3002<\/p>\n<h4>12.2 \u81ea\u5b9a\u4e49\u8f93\u51fa\u683c\u5f0f<\/h4>\n<p>\u57fa\u672c\u7ed3\u6784&#xff1a;<\/p>\n<p><span class=\"token function\">date<\/span> <span class=\"token string\">&#039;&#043;\u683c\u5f0f&#039;<\/span><\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># date &#039;&#043;%Y-%m-%d&#039;<\/span><br \/>\n<span class=\"token number\">2026<\/span>-07-31<\/p>\n<p>\u540c\u65f6\u663e\u793a\u65e5\u671f\u548c\u65f6\u95f4&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># date &#039;&#043;%Y-%m-%d %H:%M:%S&#039;<\/span><br \/>\n<span class=\"token number\">2026<\/span>-07-31 <span class=\"token number\">21<\/span>:00:00<\/p>\n<p>\u7531\u4e8e\u683c\u5f0f\u4e2d\u5b58\u5728\u7a7a\u683c&#xff0c;\u5efa\u8bae\u4f7f\u7528\u5f15\u53f7\u5305\u56f4\u3002<\/p>\n<h4>12.3 \u5e38\u89c1\u683c\u5f0f\u7b26<\/h4>\n<table>\n<tr>\u683c\u5f0f\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>%Y<\/td>\n<td>\u56db\u4f4d\u5e74\u4efd<\/td>\n<\/tr>\n<tr>\n<td>%m<\/td>\n<td>\u6708\u4efd&#xff0c;01&#xff5e;12<\/td>\n<\/tr>\n<tr>\n<td>%d<\/td>\n<td>\u65e5\u671f&#xff0c;01&#xff5e;31<\/td>\n<\/tr>\n<tr>\n<td>%H<\/td>\n<td>\u5c0f\u65f6&#xff0c;00&#xff5e;23<\/td>\n<\/tr>\n<tr>\n<td>%M<\/td>\n<td>\u5206\u949f&#xff0c;00&#xff5e;59<\/td>\n<\/tr>\n<tr>\n<td>%S<\/td>\n<td>\u79d2<\/td>\n<\/tr>\n<tr>\n<td>%F<\/td>\n<td>\u7b49\u4ef7\u4e8e %Y-%m-%d<\/td>\n<\/tr>\n<tr>\n<td>%T<\/td>\n<td>\u901a\u5e38\u7b49\u4ef7\u4e8e %H:%M:%S<\/td>\n<\/tr>\n<tr>\n<td>%s<\/td>\n<td>Unix \u65f6\u95f4\u6233<\/td>\n<\/tr>\n<tr>\n<td>%X<\/td>\n<td>\u5f53\u524d\u533a\u57df\u8bbe\u7f6e\u4e0b\u7684\u65f6\u95f4\u8868\u793a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># date &#039;&#043;%F %T&#039;<\/span><br \/>\n<span class=\"token number\">2026<\/span>-07-31 <span class=\"token number\">21<\/span>:00:00<\/p>\n<h4>12.4 Unix \u65f6\u95f4\u6233<\/h4>\n<p>\u67e5\u770b\u5f53\u524d\u65f6\u95f4\u6233&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># date &#043;%s<\/span><br \/>\n<span class=\"token number\">1785502800<\/span><\/p>\n<p>Unix \u65f6\u95f4\u6233\u901a\u5e38\u8868\u793a&#xff1a;<\/p>\n<p>\u4ece 1970 \u5e74 1 \u6708 1 \u65e5 00:00:00 UTC \u5f00\u59cb\u7ecf\u8fc7\u7684\u79d2\u6570\u3002<\/p>\n<p>\u65f6\u95f4\u6233\u4e0d\u76f4\u63a5\u643a\u5e26\u672c\u5730\u65f6\u533a\u4fe1\u606f\u3002<\/p>\n<p>\u540c\u4e00\u4e2a\u65f6\u95f4\u6233\u5728\u4e0d\u540c\u5730\u533a\u683c\u5f0f\u5316\u540e&#xff0c;\u53ef\u80fd\u663e\u793a\u4e0d\u540c\u7684\u672c\u5730\u65f6\u95f4\u3002<\/p>\n<h4>12.5 \u628a\u65f6\u95f4\u6233\u8f6c\u6362\u4e3a\u53ef\u8bfb\u65f6\u95f4<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># date -d &#039;&#064;0&#039; &#039;&#043;%F %T&#039;<\/span><br \/>\n<span class=\"token number\">1970<\/span>-01-01 08:00:00<\/p>\n<p>\u5982\u679c\u7cfb\u7edf\u65f6\u533a\u662f\u4e1c\u516b\u533a&#xff0c;\u65f6\u95f4\u6233 0 \u53ef\u80fd\u663e\u793a\u4e3a&#xff1a;<\/p>\n<p>1970-01-01 08:00:00<\/p>\n<p>\u67e5\u770b UTC \u65f6\u95f4\u53ef\u4ee5\u4f7f\u7528&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># date -u -d &#039;&#064;0&#039; &#039;&#043;%F %T&#039;<\/span><br \/>\n<span class=\"token number\">1970<\/span>-01-01 00:00:00<\/p>\n<p>\u8f6c\u6362\u5176\u4ed6\u65f6\u95f4\u6233&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># date -d &#039;&#064;1000000000&#039; &#039;&#043;%F %T&#039;<\/span><br \/>\n<span class=\"token number\">2001<\/span>-09-09 09:46:40<\/p>\n<p>\u5177\u4f53\u7ed3\u679c\u4f1a\u53d7\u5230\u672c\u5730\u65f6\u533a\u5f71\u54cd\u3002<\/p>\n<h4>12.6 \u8bbe\u7f6e\u7cfb\u7edf\u65f6\u95f4<\/h4>\n<p>\u5177\u6709\u76f8\u5e94\u6743\u9650\u65f6&#xff0c;\u53ef\u4ee5\u4f7f\u7528&#xff1a;<\/p>\n<p><span class=\"token function\">date<\/span> <span class=\"token parameter variable\">-s<\/span> <span class=\"token string\">&#039;2026-07-31 21:00:00&#039;<\/span><\/p>\n<p>\u4f46\u73b0\u4ee3 Linux \u7cfb\u7edf\u901a\u5e38\u4f7f\u7528&#xff1a;<\/p>\n<p>NTP<br \/>\nchrony<br \/>\nsystemd-timesyncd<\/p>\n<p>\u7b49\u670d\u52a1\u81ea\u52a8\u540c\u6b65\u65f6\u95f4\u3002<\/p>\n<p>\u968f\u610f\u624b\u52a8\u4fee\u6539\u670d\u52a1\u5668\u65f6\u95f4\u53ef\u80fd\u5f71\u54cd&#xff1a;<\/p>\n<p>\u65e5\u5fd7\u987a\u5e8f<br \/>\n\u6570\u636e\u5e93\u4e8b\u52a1<br \/>\n\u8bc1\u4e66\u9a8c\u8bc1<br \/>\n\u5b9a\u65f6\u4efb\u52a1<br \/>\n\u5206\u5e03\u5f0f\u7cfb\u7edf<\/p>\n<p>\u56e0\u6b64\u751f\u4ea7\u670d\u52a1\u5668\u4e0a\u4e0d\u8981\u968f\u610f\u4f7f\u7528 date -s\u3002<\/p>\n<hr \/>\n<h3>\u5341\u4e09\u3001cal&#xff1a;\u67e5\u770b\u65e5\u5386<\/h3>\n<p>cal \u7528\u4e8e\u5728\u7ec8\u7aef\u4e2d\u663e\u793a\u65e5\u5386\u3002<\/p>\n<p>\u67d0\u4e9b\u7cbe\u7b80\u7cfb\u7edf\u9ed8\u8ba4\u6ca1\u6709\u5b89\u88c5\u8be5\u547d\u4ee4&#xff0c;\u51fa\u73b0 command not found \u65f6&#xff0c;\u9700\u8981\u901a\u8fc7\u53d1\u884c\u7248\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u5b89\u88c5\u76f8\u5173\u65e5\u5386\u5de5\u5177\u3002<\/p>\n<h4>13.1 \u67e5\u770b\u5f53\u524d\u6708\u4efd<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cal<\/span><br \/>\n     July <span class=\"token number\">2026<\/span><br \/>\nSu Mo Tu We Th Fr Sa<br \/>\n          <span class=\"token number\">1<\/span>  <span class=\"token number\">2<\/span>  <span class=\"token number\">3<\/span>  <span class=\"token number\">4<\/span><br \/>\n <span class=\"token number\">5<\/span>  <span class=\"token number\">6<\/span>  <span class=\"token number\">7<\/span>  <span class=\"token number\">8<\/span>  <span class=\"token number\">9<\/span> <span class=\"token number\">10<\/span> <span class=\"token number\">11<\/span><br \/>\n<span class=\"token number\">12<\/span> <span class=\"token number\">13<\/span> <span class=\"token number\">14<\/span> <span class=\"token number\">15<\/span> <span class=\"token number\">16<\/span> <span class=\"token number\">17<\/span> <span class=\"token number\">18<\/span><br \/>\n<span class=\"token number\">19<\/span> <span class=\"token number\">20<\/span> <span class=\"token number\">21<\/span> <span class=\"token number\">22<\/span> <span class=\"token number\">23<\/span> <span class=\"token number\">24<\/span> <span class=\"token number\">25<\/span><br \/>\n<span class=\"token number\">26<\/span> <span class=\"token number\">27<\/span> <span class=\"token number\">28<\/span> <span class=\"token number\">29<\/span> <span class=\"token number\">30<\/span> <span class=\"token number\">31<\/span><\/p>\n<h4>13.2 \u67e5\u770b\u6307\u5b9a\u5e74\u4efd<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cal 2026<\/span><\/p>\n<p>\u5b83\u4f1a\u663e\u793a 2026 \u5e74\u5168\u5e74\u7684\u65e5\u5386\u3002<\/p>\n<h4>13.3 \u67e5\u770b\u6307\u5b9a\u6708\u4efd<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cal 7 2026<\/span><\/p>\n<p>\u8868\u793a\u67e5\u770b 2026 \u5e74 7 \u6708\u3002<\/p>\n<p>\u53c2\u6570\u987a\u5e8f\u662f&#xff1a;<\/p>\n<p>\u6708\u4efd \u5e74\u4efd<\/p>\n<h4>13.4 \u67e5\u770b\u76f8\u90bb\u4e09\u4e2a\u6708<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cal -3<\/span><\/p>\n<p>\u901a\u5e38\u4f1a\u663e\u793a&#xff1a;<\/p>\n<p>\u4e0a\u4e00\u4e2a\u6708<br \/>\n\u5f53\u524d\u6708<br \/>\n\u4e0b\u4e00\u4e2a\u6708<\/p>\n<h4>13.5 \u67e5\u770b\u5168\u5e74<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cal -y<\/span><\/p>\n<p>-y \u7528\u4e8e\u663e\u793a\u5f53\u524d\u5e74\u4efd\u7684\u5168\u5e74\u65e5\u5386\u3002<\/p>\n<h4>13.6 \u663e\u793a\u4e00\u5e74\u4e2d\u7684\u7b2c\u51e0\u5929<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cal -j<\/span><\/p>\n<p>\u666e\u901a\u65e5\u5386\u663e\u793a\u201c\u67d0\u6708\u67d0\u65e5\u201d&#xff0c;\u800c -j \u4f1a\u6309\u7167\u4e00\u5e74\u4e2d\u7684\u5929\u6570\u7f16\u53f7\u663e\u793a\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>1 \u6708 1 \u65e5\u662f\u7b2c 1 \u5929<br \/>\n2 \u6708 1 \u65e5\u662f\u7b2c 32 \u5929<\/p>\n<p>\u95f0\u5e74\u548c\u666e\u901a\u5e74\u4efd\u7684\u7ed3\u679c\u4f1a\u6709\u6240\u4e0d\u540c\u3002<\/p>\n<hr \/>\n<h3>\u5341\u56db\u3001find&#xff1a;\u5728\u76ee\u5f55\u6811\u4e2d\u67e5\u627e\u6587\u4ef6<\/h3>\n<p>find \u662f Linux \u4e2d\u529f\u80fd\u975e\u5e38\u5f3a\u5927\u7684\u6587\u4ef6\u67e5\u627e\u5de5\u5177\u3002<\/p>\n<p>\u5b83\u4f1a\u5b9e\u9645\u904d\u5386\u6307\u5b9a\u76ee\u5f55\u6811&#xff0c;\u6839\u636e\u6761\u4ef6\u5339\u914d\u6587\u4ef6\u3002<\/p>\n<h4>14.1 \u57fa\u672c\u8bed\u6cd5<\/h4>\n<p><span class=\"token function\">find<\/span> \u8d77\u59cb\u8def\u5f84 \u67e5\u627e\u6761\u4ef6<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p><span class=\"token function\">find<\/span> \/root <span class=\"token parameter variable\">-name<\/span> <span class=\"token string\">&#039;test.c&#039;<\/span><\/p>\n<p>\u542b\u4e49\u662f&#xff1a;<\/p>\n<p>\u4ece \/root \u5f00\u59cb<br \/>\n\u9012\u5f52\u904d\u5386\u4e0b\u9762\u7684\u76ee\u5f55<br \/>\n\u67e5\u627e\u540d\u79f0\u4e3a test.c \u7684\u9879\u76ee<\/p>\n<h4>14.2 \u6309\u6587\u4ef6\u540d\u67e5\u627e<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/root -name &#039;test.c&#039;<\/span><br \/>\n\/root\/project\/test.c<br \/>\n\/root\/project\/old\/test.c<\/p>\n<p>\u67e5\u627e\u6240\u6709 .cpp \u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/root -name &#039;*.cpp&#039;<\/span><\/p>\n<p>\u5efa\u8bae\u7ed9\u901a\u914d\u8868\u8fbe\u5f0f\u52a0\u4e0a\u5f15\u53f7&#xff1a;<\/p>\n<p><span class=\"token string\">&#039;*.cpp&#039;<\/span><\/p>\n<p>\u5426\u5219 Shell \u53ef\u80fd\u4f1a\u5728 find \u6267\u884c\u524d\u63d0\u524d\u5c55\u5f00 *\u3002<\/p>\n<h4>14.3 \u5ffd\u7565\u6587\u4ef6\u540d\u5927\u5c0f\u5199<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/root -iname &#039;readme.md&#039;<\/span><\/p>\n<p>\u5b83\u53ef\u4ee5\u540c\u65f6\u5339\u914d&#xff1a;<\/p>\n<p>README.md<br \/>\nReadme.md<br \/>\nreadme.md<\/p>\n<h4>14.4 \u6309\u7c7b\u578b\u67e5\u627e<\/h4>\n<p>\u53ea\u67e5\u666e\u901a\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/root\/linux_demo -type f<\/span><\/p>\n<p>\u53ea\u67e5\u76ee\u5f55&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/root\/linux_demo -type d<\/span><\/p>\n<p>\u5e38\u89c1\u7c7b\u578b\u5305\u62ec&#xff1a;<\/p>\n<table>\n<tr>\u7c7b\u578b\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>f<\/td>\n<td>\u666e\u901a\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>d<\/td>\n<td>\u76ee\u5f55<\/td>\n<\/tr>\n<tr>\n<td>l<\/td>\n<td>\u7b26\u53f7\u94fe\u63a5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7ec4\u5408\u6587\u4ef6\u540d\u548c\u7c7b\u578b&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/root\/linux_demo -type f -name &#039;*.txt&#039;<\/span><\/p>\n<h4>14.5 \u9650\u5236\u641c\u7d22\u6df1\u5ea6<\/h4>\n<p>\u53ea\u641c\u7d22\u8d77\u59cb\u76ee\u5f55\u548c\u4e0b\u4e00\u5c42&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/root\/linux_demo -maxdepth 2 -type f<\/span><\/p>\n<p>-maxdepth \u53ef\u4ee5\u907f\u514d\u65e0\u610f\u4e49\u5730\u904d\u5386\u8fc7\u6df1\u7684\u76ee\u5f55\u3002<\/p>\n<h4>14.6 \u6309\u6587\u4ef6\u5927\u5c0f\u67e5\u627e<\/h4>\n<p>\u67e5\u627e\u5927\u4e8e 10 MB \u7684\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/root -type f -size &#043;10M<\/span><\/p>\n<p>\u67e5\u627e\u5c0f\u4e8e 1 KB \u7684\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/root -type f -size -1k<\/span><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p>&#043;&#xff1a;\u5927\u4e8e<br \/>\n-&#xff1a;\u5c0f\u4e8e<br \/>\nM&#xff1a;MiB \u91cf\u7ea7\u5355\u4f4d<br \/>\nk&#xff1a;KiB \u91cf\u7ea7\u5355\u4f4d<\/p>\n<h4>14.7 \u6309\u4fee\u6539\u65f6\u95f4\u67e5\u627e<\/h4>\n<p>\u67e5\u627e\u6700\u8fd1 7 \u5929\u4fee\u6539\u8fc7\u7684\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/root -type f -mtime -7<\/span><\/p>\n<p>\u67e5\u627e\u8d85\u8fc7 30 \u5929\u6ca1\u6709\u4fee\u6539\u7684\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/root -type f -mtime &#043;30<\/span><\/p>\n<h4>14.8 \u5bf9\u67e5\u627e\u7ed3\u679c\u6267\u884c\u64cd\u4f5c<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find \/root\/linux_demo -type f -name &#039;*.txt&#039; -exec ls -l &#8212; {} \\\\;<\/span><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p>{}  \u8868\u793a\u5f53\u524d\u627e\u5230\u7684\u6587\u4ef6<br \/>\n\\\\;  \u8868\u793a -exec \u64cd\u4f5c\u7ed3\u675f<\/p>\n<p>\u6267\u884c\u5220\u9664\u7b49\u5371\u9669\u64cd\u4f5c\u524d&#xff0c;\u5e94\u5f53\u5148\u53ea\u8f93\u51fa\u7ed3\u679c&#xff1a;<\/p>\n<p><span class=\"token function\">find<\/span> \/root\/linux_demo <span class=\"token parameter variable\">-type<\/span> f <span class=\"token parameter variable\">-name<\/span> <span class=\"token string\">&#039;*.tmp&#039;<\/span> <span class=\"token parameter variable\">-print<\/span><\/p>\n<p>\u786e\u8ba4\u65e0\u8bef\u540e&#xff0c;\u518d\u8003\u8651\u8fdb\u884c\u540e\u7eed\u5904\u7406\u3002<\/p>\n<h4>14.9 find \u548c\u666e\u901a\u6587\u4ef6\u540d\u67e5\u627e\u7684\u533a\u522b<\/h4>\n<p>find \u641c\u7d22\u7684\u662f\u6587\u4ef6\u7cfb\u7edf\u76ee\u5f55\u6811\u3002<\/p>\n<p>\u5b83\u53ef\u4ee5\u6839\u636e&#xff1a;<\/p>\n<p>\u540d\u79f0<br \/>\n\u7c7b\u578b<br \/>\n\u5927\u5c0f<br \/>\n\u4fee\u6539\u65f6\u95f4<br \/>\n\u6743\u9650<br \/>\n\u6240\u6709\u8005<br \/>\n\u8def\u5f84<\/p>\n<p>\u7b49\u6761\u4ef6\u67e5\u627e\u3002<\/p>\n<p>\u529f\u80fd\u975e\u5e38\u5f3a&#xff0c;\u4f46\u4ece\u5927\u76ee\u5f55\u5f00\u59cb\u641c\u7d22\u65f6\u53ef\u80fd\u4ea7\u751f\u8f83\u591a\u78c1\u76d8\u8bbf\u95ee&#xff0c;\u56e0\u6b64\u8d77\u59cb\u8def\u5f84\u5e94\u5c3d\u91cf\u5177\u4f53\u3002<\/p>\n<p>\u4e0d\u63a8\u8350\u5728\u6ca1\u6709\u5fc5\u8981\u65f6\u76f4\u63a5\u6267\u884c&#xff1a;<\/p>\n<p><span class=\"token function\">find<\/span> \/<\/p>\n<p>\u8fd9\u53ef\u80fd\u904d\u5386\u5927\u91cf\u7cfb\u7edf\u76ee\u5f55&#xff0c;\u5e76\u4ea7\u751f\u6743\u9650\u9519\u8bef\u6216\u8f83\u957f\u7b49\u5f85\u65f6\u95f4\u3002<\/p>\n<hr \/>\n<h3>\u5341\u4e94\u3001which&#xff1a;\u67e5\u627e\u547d\u4ee4\u5bf9\u5e94\u7684\u7a0b\u5e8f\u8def\u5f84<\/h3>\n<p>which \u7528\u4e8e\u5728\u5f53\u524d PATH \u73af\u5883\u53d8\u91cf\u6307\u5b9a\u7684\u76ee\u5f55\u4e2d&#xff0c;\u67e5\u627e\u67d0\u6761\u547d\u4ee4\u5bf9\u5e94\u7684\u53ef\u6267\u884c\u7a0b\u5e8f\u3002<\/p>\n<h4>15.1 \u57fa\u672c\u4f7f\u7528<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># which ls<\/span><br \/>\n\/usr\/bin\/ls<\/p>\n<p>\u67e5\u770b gcc&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># which gcc<\/span><br \/>\n\/usr\/bin\/gcc<\/p>\n<p>\u67e5\u770b python3&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># which python3<\/span><br \/>\n\/usr\/bin\/python3<\/p>\n<p>\u5982\u679c\u6ca1\u6709\u627e\u5230&#xff0c;\u901a\u5e38\u4e0d\u4f1a\u8f93\u51fa\u8def\u5f84&#xff0c;\u5e76\u8fd4\u56de\u975e\u96f6\u72b6\u6001\u3002<\/p>\n<h4>15.2 PATH \u662f\u4ec0\u4e48&#xff1f;<\/h4>\n<p>\u6267\u884c&#xff1a;<\/p>\n<p><span class=\"token function\">ls<\/span><\/p>\n<p>\u65f6&#xff0c;\u6211\u4eec\u5e76\u6ca1\u6709\u8f93\u5165\u5b8c\u6574\u8def\u5f84&#xff1a;<\/p>\n<p>\/usr\/bin\/ls<\/p>\n<p>Shell \u4f1a\u6309\u7167 PATH \u4e2d\u8bb0\u5f55\u7684\u76ee\u5f55\u987a\u5e8f\u5bfb\u627e\u53ef\u6267\u884c\u7a0b\u5e8f\u3002<\/p>\n<p>\u67e5\u770b PATH&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># echo &#034;$PATH&#034;<\/span><br \/>\n\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/root\/bin<\/p>\n<p>\u8fd9\u4e9b\u8def\u5f84\u4f7f\u7528\u5192\u53f7\u5206\u9694\u3002<\/p>\n<p>Shell \u4f1a\u4f9d\u6b21\u5c1d\u8bd5&#xff1a;<\/p>\n<p>\/usr\/local\/sbin\/ls<br \/>\n\/usr\/local\/bin\/ls<br \/>\n\/usr\/sbin\/ls<br \/>\n\/usr\/bin\/ls<br \/>\n\/root\/bin\/ls<\/p>\n<p>\u627e\u5230\u53ef\u6267\u884c\u6587\u4ef6\u540e\u4fbf\u505c\u6b62\u641c\u7d22\u3002<\/p>\n<h4>15.3 which \u4e0d\u4e00\u5b9a\u80fd\u8bf4\u660e\u5b9e\u9645\u6267\u884c\u7684\u5185\u5bb9<\/h4>\n<p>\u6709\u4e9b\u547d\u4ee4\u53ef\u80fd\u662f&#xff1a;<\/p>\n<p>Shell \u5185\u5efa\u547d\u4ee4<br \/>\n\u522b\u540d<br \/>\nShell \u51fd\u6570<br \/>\n\u5916\u90e8\u53ef\u6267\u884c\u7a0b\u5e8f<\/p>\n<p>\u4f8b\u5982 pwd \u901a\u5e38\u65e2\u6709 Bash \u5185\u5efa\u7248\u672c&#xff0c;\u4e5f\u53ef\u80fd\u5b58\u5728&#xff1a;<\/p>\n<p>\/usr\/bin\/pwd<\/p>\n<p>\u6267\u884c&#xff1a;<\/p>\n<p><span class=\"token function\">which<\/span> <span class=\"token builtin class-name\">pwd<\/span><\/p>\n<p>\u53ef\u80fd\u663e\u793a&#xff1a;<\/p>\n<p>\/usr\/bin\/pwd<\/p>\n<p>\u4f46\u5f53\u524d Shell \u771f\u6b63\u6267\u884c\u7684\u53ef\u80fd\u4f18\u5148\u662f\u5185\u5efa\u7248\u672c\u3002<\/p>\n<h4>15.4 \u4f7f\u7528 type \u67e5\u770b\u5b8c\u6574\u6765\u6e90<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># type ls<\/span><br \/>\n<span class=\"token function\">ls<\/span> is aliased to <span class=\"token string\">&#039;ls &#8211;color&#061;auto&#039;<\/span><\/p>\n<p>\u67e5\u770b\u6240\u6709\u53ef\u80fd\u6765\u6e90&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># type -a pwd<\/span><br \/>\n<span class=\"token builtin class-name\">pwd<\/span> is a shell <span class=\"token builtin class-name\">builtin<\/span><br \/>\n<span class=\"token builtin class-name\">pwd<\/span> is \/usr\/bin\/pwd<br \/>\n<span class=\"token builtin class-name\">pwd<\/span> is \/bin\/pwd<\/p>\n<p>\u56e0\u6b64&#xff1a;<\/p>\n<p>which&#xff1a;\u4e3b\u8981\u67e5\u627e PATH \u4e2d\u7684\u5916\u90e8\u53ef\u6267\u884c\u7a0b\u5e8f<br \/>\ntype &#xff1a;\u5224\u65ad\u547d\u4ee4\u662f\u522b\u540d\u3001\u51fd\u6570\u3001\u5185\u5efa\u547d\u4ee4\u8fd8\u662f\u5916\u90e8\u7a0b\u5e8f<\/p>\n<h4>15.5 \u5728\u811a\u672c\u4e2d\u4f7f\u7528 command -v<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># command -v gcc<\/span><br \/>\n\/usr\/bin\/gcc<\/p>\n<p>\u5224\u65ad\u67d0\u4e2a\u547d\u4ee4\u662f\u5426\u5b58\u5728&#xff1a;<\/p>\n<p><span class=\"token keyword\">if<\/span> <span class=\"token builtin class-name\">command<\/span> <span class=\"token parameter variable\">-v<\/span> gcc <span class=\"token operator\">&gt;<\/span>\/dev\/null <span class=\"token operator\"><span class=\"token file-descriptor important\">2<\/span>&gt;<\/span><span class=\"token file-descriptor important\">&amp;1<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">then<\/span><br \/>\n    <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;gcc \u5df2\u5b89\u88c5&#034;<\/span><br \/>\n<span class=\"token keyword\">else<\/span><br \/>\n    <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;\u672a\u627e\u5230 gcc&#034;<\/span><br \/>\n<span class=\"token keyword\">fi<\/span><\/p>\n<p>\u811a\u672c\u4e2d\u901a\u5e38\u66f4\u63a8\u8350\u4f7f\u7528&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">command<\/span> <span class=\"token parameter variable\">-v<\/span><\/p>\n<p>\u800c\u4e0d\u662f\u4f9d\u8d56\u4e0d\u540c\u7cfb\u7edf\u4e0a\u5b9e\u73b0\u53ef\u80fd\u4e0d\u540c\u7684 which\u3002<\/p>\n<hr \/>\n<h3>\u5341\u516d\u3001\u628a\u8fd9\u4e00\u9636\u6bb5\u7684\u547d\u4ee4\u4e32\u8d77\u6765<\/h3>\n<p>\u4e0b\u9762\u901a\u8fc7\u4e00\u4e2a\u5b8c\u6574\u7ec3\u4e60&#xff0c;\u628a\u672c\u6587\u547d\u4ee4\u8fde\u63a5\u8d77\u6765\u3002<\/p>\n<h4>16.1 \u521b\u5efa\u7ec3\u4e60\u76ee\u5f55<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mkdir -p \/root\/linux_demo\/article\/src<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cd \/root\/linux_demo\/article<\/span><\/p>\n<p>\u786e\u8ba4\u5f53\u524d\u4f4d\u7f6e&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx article<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># pwd<\/span><br \/>\n\/root\/linux_demo\/article<\/p>\n<h4>16.2 \u521b\u5efa\u6d4b\u8bd5\u6587\u4ef6<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx article<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># for i in $(seq 1 200); do echo &#034;line $i&#034;; done &gt; data.txt<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx article<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># touch src\/main.cpp<\/span><\/p>\n<h4>16.3 \u67e5\u770b\u6587\u4ef6<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx article<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># head -n 5 data.txt<\/span><br \/>\nline <span class=\"token number\">1<\/span><br \/>\nline <span class=\"token number\">2<\/span><br \/>\nline <span class=\"token number\">3<\/span><br \/>\nline <span class=\"token number\">4<\/span><br \/>\nline <span class=\"token number\">5<\/span><\/p>\n<p>\u67e5\u770b\u7ed3\u5c3e&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx article<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># tail -n 3 data.txt<\/span><br \/>\nline <span class=\"token number\">198<\/span><br \/>\nline <span class=\"token number\">199<\/span><br \/>\nline <span class=\"token number\">200<\/span><\/p>\n<p>\u5206\u9875\u6d4f\u89c8&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx article<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># less -N data.txt<\/span><\/p>\n<h4>16.4 \u590d\u5236\u9879\u76ee<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx article<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cd ..<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cp -a article article_backup<\/span><\/p>\n<p>\u67e5\u770b&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find article_backup -maxdepth 3<\/span><br \/>\narticle_backup<br \/>\narticle_backup\/data.txt<br \/>\narticle_backup\/src<br \/>\narticle_backup\/src\/main.cpp<\/p>\n<h4>16.5 \u79fb\u52a8\u6587\u4ef6<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mkdir logs<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mv article\/data.txt logs\/data.log<\/span><\/p>\n<h4>16.6 \u67e5\u627e\u6587\u4ef6<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># find . -type f -name &#039;*.cpp&#039;<\/span><br \/>\n.\/article\/src\/main.cpp<br \/>\n.\/article_backup\/src\/main.cpp<\/p>\n<h4>16.7 \u67e5\u770b\u547d\u4ee4\u8def\u5f84\u548c\u5e2e\u52a9<\/h4>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># which find<\/span><br \/>\n\/usr\/bin\/find<\/p>\n<p>\u67e5\u770b\u624b\u518c&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># man find<\/span><\/p>\n<h4>16.8 \u6e05\u7406\u7ec3\u4e60\u76ee\u5f55<\/h4>\n<p>\u5148\u68c0\u67e5&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># pwd<\/span><br \/>\n\/root\/linux_demo<br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ls -al<\/span><\/p>\n<p>\u518d\u4ea4\u4e92\u5f0f\u5220\u9664&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;xxx linux_demo<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># rm -ri article article_backup logs<\/span><\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>Linux \u57fa\u7840\u6307\u4ee4&#xff08;\u4e8c&#xff09;&#xff1a;\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e &#x1f525; \u661f\u6052\u968f\u98ce&#xff1a;\u4e2a\u4eba\u4e3b\u9875\u2744\ufe0f \u4e2a\u4eba\u4e13\u680f&#xff1a;\u300a\u6307\u9488\u5408\u96c6\u300b&#xff5c;\u300aC\u8bed\u8a00\u57fa\u7840\u300b&#xff5c;\u300a\u6570\u636e\u7ed3\u6784\u300b&#xff5c;\u300a\u673a\u5668\u5b66\u4e60\u5bfc\u8bba\u300b&#xff5c;\u300a\u524d\u7aef\u57fa\u7840\u300b&#xff5c; \u300apython\u57fa\u7840\u300b&#xff5c; \u300aC\u4ece\u5165\u95e8\u5230\u5165\u571f\u300b&#xff5c; \u300aLinux\u7684\u5b66\u4e60\u4e4b\u65c5\u300b \u2728 \u6570\u636e\u5373\u77e5\u8bc6&#xff0c;\u538b\u7f29\u5373<\/p>\n","protected":false},"author":2,"featured_media":88330,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9099,58,371,43,305,44],"topic":[],"class_list":["post-88331","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-9099","tag-linux","tag-371","tag-43","tag-305","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux \u57fa\u7840\u6307\u4ee4\uff08\u4e8c\uff09\uff1a\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e - \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\/88331.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux \u57fa\u7840\u6307\u4ee4\uff08\u4e8c\uff09\uff1a\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"Linux \u57fa\u7840\u6307\u4ee4&#xff08;\u4e8c&#xff09;&#xff1a;\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e &#x1f525; \u661f\u6052\u968f\u98ce&#xff1a;\u4e2a\u4eba\u4e3b\u9875\u2744\ufe0f \u4e2a\u4eba\u4e13\u680f&#xff1a;\u300a\u6307\u9488\u5408\u96c6\u300b&#xff5c;\u300aC\u8bed\u8a00\u57fa\u7840\u300b&#xff5c;\u300a\u6570\u636e\u7ed3\u6784\u300b&#xff5c;\u300a\u673a\u5668\u5b66\u4e60\u5bfc\u8bba\u300b&#xff5c;\u300a\u524d\u7aef\u57fa\u7840\u300b&#xff5c; \u300apython\u57fa\u7840\u300b&#xff5c; \u300aC\u4ece\u5165\u95e8\u5230\u5165\u571f\u300b&#xff5c; \u300aLinux\u7684\u5b66\u4e60\u4e4b\u65c5\u300b \u2728 \u6570\u636e\u5373\u77e5\u8bc6&#xff0c;\u538b\u7f29\u5373\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/88331.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-31T14:48:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260731144829-6a6cb5bd7f0ec.png\" \/>\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=\"13 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/88331.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/88331.html\",\"name\":\"Linux \u57fa\u7840\u6307\u4ee4\uff08\u4e8c\uff09\uff1a\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-31T14:48:30+00:00\",\"dateModified\":\"2026-07-31T14:48:30+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/88331.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/88331.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/88331.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux \u57fa\u7840\u6307\u4ee4\uff08\u4e8c\uff09\uff1a\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e\"}]},{\"@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":"Linux \u57fa\u7840\u6307\u4ee4\uff08\u4e8c\uff09\uff1a\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e - \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\/88331.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux \u57fa\u7840\u6307\u4ee4\uff08\u4e8c\uff09\uff1a\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"Linux \u57fa\u7840\u6307\u4ee4&#xff08;\u4e8c&#xff09;&#xff1a;\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e &#x1f525; \u661f\u6052\u968f\u98ce&#xff1a;\u4e2a\u4eba\u4e3b\u9875\u2744\ufe0f \u4e2a\u4eba\u4e13\u680f&#xff1a;\u300a\u6307\u9488\u5408\u96c6\u300b&#xff5c;\u300aC\u8bed\u8a00\u57fa\u7840\u300b&#xff5c;\u300a\u6570\u636e\u7ed3\u6784\u300b&#xff5c;\u300a\u673a\u5668\u5b66\u4e60\u5bfc\u8bba\u300b&#xff5c;\u300a\u524d\u7aef\u57fa\u7840\u300b&#xff5c; \u300apython\u57fa\u7840\u300b&#xff5c; \u300aC\u4ece\u5165\u95e8\u5230\u5165\u571f\u300b&#xff5c; \u300aLinux\u7684\u5b66\u4e60\u4e4b\u65c5\u300b \u2728 \u6570\u636e\u5373\u77e5\u8bc6&#xff0c;\u538b\u7f29\u5373","og_url":"https:\/\/www.wsisp.com\/helps\/88331.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-31T14:48:30+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260731144829-6a6cb5bd7f0ec.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"13 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/88331.html","url":"https:\/\/www.wsisp.com\/helps\/88331.html","name":"Linux \u57fa\u7840\u6307\u4ee4\uff08\u4e8c\uff09\uff1a\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-31T14:48:30+00:00","dateModified":"2026-07-31T14:48:30+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/88331.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/88331.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/88331.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux \u57fa\u7840\u6307\u4ee4\uff08\u4e8c\uff09\uff1a\u6587\u4ef6\u590d\u5236\u79fb\u52a8\u3001\u5185\u5bb9\u67e5\u770b\u3001\u65f6\u95f4\u7ba1\u7406\u4e0e\u547d\u4ee4\u67e5\u627e"}]},{"@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\/88331","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=88331"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/88331\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/88330"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=88331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=88331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=88331"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=88331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}