{"id":87215,"date":"2024-01-20T05:49:12","date_gmt":"2024-01-19T21:49:12","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=87215"},"modified":"2024-01-20T05:49:12","modified_gmt":"2024-01-19T21:49:12","slug":"three-command-tools","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/three-command-tools.html","title":{"rendered":"Linux \u4e09\u4e2a\u547d\u4ee4\u5de5\u5177\uff01"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nLinux \u684c\u9762\u4ece\u5f00\u59cb\u7684\u7b80\u964b\u5230\u73b0\u5728\u8d70\u4e86\u5f88\u957f\u7684\u8def\u3002\u5728\u6211\u65e9\u671f\u4f7f\u7528 Linux \u7684\u90a3\u6bb5\u65e5\u5b50\u91cc\uff0c\u638c\u63e1\u547d\u4ee4\u884c\u662f\u6700\u57fa\u672c\u7684 \u2014\u2014 \u5373\u4f7f\u662f\u5728\u684c\u9762\u7248\u3002\u4e0d\u8fc7\u73b0\u5728\u53d8\u4e86\uff0c\u5f88\u591a\u4eba\u53ef\u80fd\u4ece\u6ca1\u7528\u8fc7\u547d\u4ee4\u884c\u3002\u4f46\u5bf9\u4e8e Linux \u7cfb\u7edf\u7ba1\u7406\u5458\u6765\u8bf4\uff0c\u53ef\u4e0d\u80fd\u8fd9\u6837\u3002\u5b9e\u9645\u4e0a\uff0c\u5bf9\u4e8e\u4efb\u4f55 Linux \u7ba1\u7406\u5458\uff08\u4e0d\u7ba1\u662f\u670d\u52a1\u5668\u8fd8\u662f\u684c\u9762\uff09\uff0c\u547d\u4ee4\u884c\u4ecd\u662f\u5fc5\u987b\u7684\u3002\u4ece\u7ba1\u7406\u7f51\u7edc\u5230\u7cfb\u7edf\u5b89\u5168\uff0c\u518d\u5230\u5e94\u7528\u548c\u7cfb\u7edf\u8bbe\u5b9a \u2014\u2014 \u6ca1\u6709\u4ec0\u4e48\u5de5\u5177\u6bd4\u547d\u4ee4\u884c\u66f4\u5f3a\u5927\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u4f46\u662f\uff0c\u5b9e\u9645\u4e0a\u2026\u2026\u4f60\u53ef\u4ee5\u5728 Linux \u7cfb\u7edf\u91cc\u627e\u5230\u975e\u5e38\u591a\u547d\u4ee4\u3002\u6bd4\u5982\u53ea\u770b \/usr\/bin \u76ee\u5f55\uff0c\u4f60\u5c31\u53ef\u4ee5\u627e\u5230\u5f88\u591a\u547d\u4ee4\u6267\u884c\u6587\u4ef6\uff08\u4f60\u53ef\u4ee5\u8fd0\u884c ls\/usr\/bin\/ | wc -l \u770b\u4e00\u4e0b\u4f60\u7684\u7cfb\u7edf\u91cc\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u5230\u5e95\u6709\u591a\u5c11\u547d\u4ee4\uff09\u3002\u5f53\u7136\uff0c\u5b83\u4eec\u5e76\u4e0d\u5168\u662f\u9488\u5bf9\u7528\u6237\u7684\u6267\u884c\u6587\u4ef6\uff0c\u4f46\u662f\u53ef\u4ee5\u8ba9\u4f60\u611f\u53d7\u4e0b Linux \u547d\u4ee4\u6570\u91cf\u3002\u5728\u6211\u7684 Elementary OS \u7cfb\u7edf\u91cc\uff0c\u76ee\u5f55 \/usr\/bin \u4e0b\u6709 2029 \u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5c3d\u7ba1\u6211\u53ea\u4f1a\u7528\u5230\u5176\u4e2d\u7684\u4e00\u5c0f\u90e8\u5206\uff0c\u6211\u8981\u600e\u4e48\u624d\u80fd\u8bb0\u4f4f\u8fd9\u4e00\u90e8\u5206\u5462\uff1f<\/p>\n

\u5e78\u8fd0\u7684\u662f\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u5de5\u5177\u548c\u6280\u5de7\uff0c\u8fd9\u6837\u4f60\u5c31\u4e0d\u7528\u6bcf\u5929\u6323\u624e\u7740\u53bb\u8bb0\u5fc6\u8fd9\u4e9b\u547d\u4ee4\u4e86\u3002\u6211\u60f3\u548c\u5927\u5bb6\u5206\u4eab\u51e0\u4e2a\u8fd9\u6837\u7684\u5c0f\u6280\u5de7\uff0c\u5e0c\u671b\u80fd\u8ba9\u4f60\u4eec\u80fd\u7a0d\u5fae\u6709\u6548\u5730\u4f7f\u7528\u547d\u4ee4\u884c\uff08\u987a\u4fbf\u8282\u7701\u70b9\u8111\u529b\uff09\u3002<\/p>\n

\u6211\u4eec\u4ece\u4e00\u4e2a\u7cfb\u7edf\u5185\u7f6e\u7684\u5de5\u5177\u5f00\u59cb\u4ecb\u7ecd\uff0c\u7136\u540e\u518d\u4ecb\u7ecd\u4e24\u4e2a\u53ef\u4ee5\u5b89\u88c5\u7684\u975e\u5e38\u5b9e\u7528\u7684\u7a0b\u5e8f\u3002<\/p>\n

Bash \u547d\u4ee4\u5386\u53f2<\/strong><\/div>\n

\u4e0d\u7ba1\u4f60\u77e5\u4e0d\u77e5\u9053\uff0cBash\uff08\u6700\u6d41\u884c\u7684 Linux shell\uff09\u4f1a\u4fdd\u7559\u4f60\u6267\u884c\u8fc7\u7684\u547d\u4ee4\u7684\u5386\u53f2\u3002\u60f3\u5b9e\u9645\u64cd\u4f5c\u4e0b\u770b\u770b\u5417\uff1f\u6709\u4e24\u79cd\u65b9\u5f0f\u3002\u6253\u5f00\u7ec8\u7aef\u7a97\u53e3\u7136\u540e\u6309\u5411\u4e0a\u65b9\u5411\u952e\u3002\u4f60\u5e94\u8be5\u53ef\u4ee5\u770b\u5230\u4f1a\u6709\u547d\u4ee4\u51fa\u73b0\uff0c\u4e00\u4e2a\u63a5\u4e00\u4e2a\u3002\u4e00\u65e6\u4f60\u627e\u5230\u4e86\u60f3\u7528\u7684\u547d\u4ee4\uff0c\u4e0d\u7528\u4fee\u6539\u7684\u8bdd\uff0c\u53ef\u4ee5\u76f4\u63a5\u6309 Enter \u952e\u6267\u884c\uff0c\u6216\u8005\u4fee\u6539\u540e\u518d\u6309 Enter \u952e\u3002<\/p>\n

\u8981\u91cd\u65b0\u6267\u884c\uff08\u6216\u4fee\u6539\u4e00\u4e0b\u518d\u6267\u884c\uff09\u4e4b\u524d\u8fd0\u884c\u8fc7\u7684\u547d\u4ee4\uff0c\u8fd9\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u65b9\u5f0f\u3002\u6211\u7ecf\u5e38\u7528\u8fd9\u4e2a\u529f\u80fd\u3002\u5b83\u4e0d\u4ec5\u4ec5\u8ba9\u6211\u4e0d\u7528\u53bb\u8bb0\u5fc6\u4e00\u4e2a\u547d\u4ee4\u7684\u6240\u6709\u7ec6\u8282\uff0c\u800c\u4e14\u53ef\u4ee5\u4e0d\u7528\u4e00\u904d\u904d\u91cd\u590d\u5730\u8f93\u5165\u540c\u6837\u7684\u547d\u4ee4\u3002<\/p>\n

\u8bf4\u5230 Bash \u7684\u547d\u4ee4\u5386\u53f2\uff0c\u5982\u679c\u4f60\u6267\u884c\u547d\u4ee4 history\uff0c\u4f60\u53ef\u4ee5\u5217\u51fa\u4f60\u8fc7\u53bb\u6267\u884c\u8fc7\u7684\u547d\u4ee4\u5217\u8868\uff08\u56fe 1\uff09\u3002
\n\"\"<\/p>\n

\u56fe 1: \u4f60\u80fd\u627e\u5230\u6211\u6572\u7684\u547d\u4ee4\u91cc\u7684\u9519\u8bef\u5417\uff1f<\/p>\n

\u4f60\u7684 Bash \u547d\u4ee4\u5386\u53f2\u4fdd\u5b58\u7684\u5386\u53f2\u547d\u4ee4\u7684\u6570\u91cf\u53ef\u4ee5\u5728 ~\/.bashrc \u6587\u4ef6\u91cc\u8bbe\u7f6e\u3002\u5728\u8fd9\u4e2a\u6587\u4ef6\u91cc\uff0c\u4f60\u53ef\u4ee5\u627e\u5230\u4e0b\u9762\u4e24\u884c\uff1a<\/p>\n

HISTSIZE=1000\r\nHISTFILESIZE=2000<\/pre>\n

HISTSIZE \u662f\u547d\u4ee4\u5386\u53f2\u5217\u8868\u91cc\u8bb0\u5f55\u7684\u547d\u4ee4\u7684\u6700\u5927\u6570\u91cf\uff0c\u800c HISTFILESIZE \u662f\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u6700\u5927\u884c\u6570\u3002<\/p>\n

\u663e\u7136\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cBash \u4f1a\u8bb0\u5f55\u4f60\u7684 1000 \u6761\u5386\u53f2\u547d\u4ee4\u3002\u8fd9\u5df2\u7ecf\u5f88\u591a\u4e86\u3002\u6709\u65f6\u5019\uff0c\u8fd9\u4e5f\u88ab\u8ba4\u4e3a\u662f\u4e00\u4e2a\u5b89\u5168\u6f0f\u6d1e\u3002\u5982\u679c\u4f60\u5728\u610f\u7684\u8bdd\uff0c\u4f60\u53ef\u4ee5\u968f\u610f\u51cf\u5c0f\u8fd9\u4e2a\u6570\u503c\uff0c\u5728\u5b89\u5168\u6027\u548c\u5b9e\u7528\u6027\u4e4b\u95f4\u5e73\u8861\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b Bash \u8bb0\u5f55\u4f60\u7684\u547d\u4ee4\u5386\u53f2\uff0c\u53ef\u4ee5\u5c06 HISTSIZE \u8bbe\u7f6e\u4e3a 0\u3002<\/p>\n

\u5982\u679c\u4f60\u4fee\u6539\u4e86 ~\/.bashrc \u6587\u4ef6\uff0c\u8bb0\u5f97\u8981\u767b\u51fa\u540e\u518d\u91cd\u65b0\u767b\u5f55\uff08\u5426\u5219\u6539\u52a8\u4e0d\u4f1a\u751f\u6548\uff09\u3002<\/p>\n

apropos<\/strong><\/div>\n

\u8fd9\u662f\u7b2c\u4e00\u4e2a\u6211\u8981\u4ecb\u7ecd\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u8bb0\u5fc6 Linux \u547d\u4ee4\u3002apropos \uff08\u610f\u5373\u201c\u5173\u4e8e\u201d\uff09\u80fd\u591f\u641c\u7d22 Linux \u5e2e\u52a9\u6587\u6863\u6765\u5e2e\u4f60\u627e\u5230\u4f60\u60f3\u8981\u7684\u547d\u4ee4\u3002\u6bd4\u5982\u8bf4\uff0c\u4f60\u4e0d\u8bb0\u5f97\u4f60\u7528\u7684\u53d1\u884c\u7248\u7528\u7684\u4ec0\u4e48\u9632\u706b\u5899\u5de5\u5177\u4e86\u3002\u4f60\u53ef\u4ee5\u8f93\u5165 apropos \u201cfirewall\u201d \uff0c\u7136\u540e\u8fd9\u4e2a\u5de5\u5177\u4f1a\u8fd4\u56de\u76f8\u5173\u7684\u547d\u4ee4\uff08\u56fe 2\uff09\u3002
\n\"\"<\/p>\n

\u56fe 2: \u4f60\u7528\u7684\u4ec0\u4e48\u9632\u706b\u5899\uff1f<\/p>\n

\u518d\u5047\u5982\u4f60\u9700\u8981\u4e00\u4e2a\u64cd\u4f5c\u76ee\u5f55\u7684\u547d\u4ee4\uff0c\u4f46\u662f\u5b8c\u5168\u4e0d\u77e5\u9053\u8981\u7528\u54ea\u4e2a\u5462\uff1f\u8f93\u5165 apropos \u201cdirectory\u201d \u5c31\u53ef\u4ee5\u5217\u51fa\u5728\u5e2e\u52a9\u6587\u6863\u91cc\u5305\u542b\u4e86\u5b57\u7b26 \u201cdirectory\u201d \u7684\u6240\u6709\u547d\u4ee4\uff08\u56fe 3\uff09\u3002<\/p>\n

\"\"<\/p>\n

\u56fe 3: \u53ef\u4ee5\u64cd\u4f5c\u76ee\u5f55\u7684\u5de5\u5177\u6709\u54ea\u4e9b\u5462\uff1f<\/p>\n

apropos \u5de5\u5177\u5728\u51e0\u4e4e\u6240\u6709 Linux \u53d1\u884c\u7248\u91cc\u90fd\u4f1a\u9ed8\u8ba4\u5b89\u88c5\u3002<\/p>\n

Fish<\/strong><\/div>\n

\u8fd8\u6709\u53e6\u4e00\u4e2a\u80fd\u5e2e\u52a9\u4f60\u8bb0\u5fc6\u547d\u4ee4\u7684\u5f88\u597d\u7684\u5de5\u5177\u3002Fish \u662f Linux\/Unix\/Mac OS \u7684\u4e00\u4e2a\u547d\u4ee4\u884c shell\uff0c\u6709\u4e00\u4e9b\u5f88\u597d\u7528\u7684\u529f\u80fd\u3002<\/p>\n