{"id":160117,"date":"2019-10-14T10:46:10","date_gmt":"2019-10-14T02:46:10","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=160117"},"modified":"2019-10-17T10:58:47","modified_gmt":"2019-10-17T02:58:47","slug":"play-linux-file","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/play-linux-file.html","title":{"rendered":"\u6559\u4f60\u73a9\u8f6cLinux\u2014\u6587\u4ef6\u5185\u5bb9\u67e5\u770b"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nLinux\u7cfb\u7edf\u4e2d\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u67e5\u770b\u6587\u4ef6\u7684\u5185\u5bb9\uff1a
\ncat\u3001tac\u3001nl\u3001more\u3001less\u3001head\u3001tail
\n\u4f60\u53ef\u4ee5\u4f7f\u7528 man [\u547d\u4ee4]\u6765\u67e5\u770b\u5404\u4e2a\u547d\u4ee4\u7684\u4f7f\u7528\u6587\u6863\uff0c\u5982 \uff1aman cp\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

cat<\/strong><\/div>\n

\u7531\u7b2c\u4e00\u884c\u5f00\u59cb\u663e\u793a\u6587\u4ef6\u5185\u5bb9<\/p>\n

\u8bed\u6cd5\uff1a<\/p>\n

cat [-AbEnTv]<\/pre>\n

\u9009\u9879\u4e0e\u53c2\u6570\uff1a<\/p>\n

-A \uff1a\u76f8\u5f53\u65bc -vET \u7684\u6574\u5408\u9009\u9879\uff0c\u53ef\u5217\u51fa\u4e00\u4e9b\u7279\u6b8a\u5b57\u7b26\u800c\u4e0d\u662f\u7a7a\u767d\u800c\u5df2\uff1b
\n-b \uff1a\u5217\u51fa\u884c\u53f7\uff0c\u4ec5\u9488\u5bf9\u975e\u7a7a\u767d\u884c\u505a\u884c\u53f7\u663e\u793a\uff0c\u7a7a\u767d\u884c\u4e0d\u6807\u884c\u53f7\uff01
\n-E \uff1a\u5c06\u7ed3\u5c3e\u7684\u65ad\u884c\u5b57\u8282 $ \u663e\u793a\u51fa\u6765\uff1b
\n-n \uff1a\u5217\u5370\u51fa\u884c\u53f7\uff0c\u8fde\u540c\u7a7a\u767d\u884c\u4e5f\u4f1a\u6709\u884c\u53f7\uff0c\u4e0e -b \u7684\u9009\u9879\u4e0d\u540c\uff1b
\n-T \uff1a\u5c06 [tab] \u6309\u952e\u4ee5 ^I \u663e\u793a\u51fa\u6765\uff1b
\n-v \uff1a\u5217\u51fa\u4e00\u4e9b\u770b\u4e0d\u51fa\u6765\u7684\u7279\u6b8a\u5b57\u7b26
\n\u68c0\u770b \/etc\/issue \u8fd9\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\uff1a<\/p>\n

[root@www ~]# cat \/etc\/issue\r\nCentOS release 6.4 (Final)\r\nKernel \\r on an \\m<\/pre>\n
tac<\/strong><\/div>\n

tac\u4e0ecat\u547d\u4ee4\u521a\u597d\u76f8\u53cd\uff0c\u6587\u4ef6\u5185\u5bb9\u4ece\u6700\u540e\u4e00\u884c\u5f00\u59cb\u663e\u793a\uff0c\u53ef\u4ee5\u770b\u51fa tac \u662f cat \u7684\u5012\u7740\u5199\uff01\u5982\uff1a<\/p>\n

[root@www ~]# tac \/etc\/issue\r\n\r\nKernel \\r on an \\m\r\nCentOS release 6.4 (Final)<\/pre>\n
nl<\/strong><\/div>\n

\u663e\u793a\u884c\u53f7<\/p>\n

\u8bed\u6cd5\uff1a<\/p>\n

nl [-bnw] \u6587\u4ef6<\/pre>\n

\u9009\u9879\u4e0e\u53c2\u6570\uff1a<\/p>\n

-b \uff1a\u6307\u5b9a\u884c\u53f7\u6307\u5b9a\u7684\u65b9\u5f0f\uff0c\u4e3b\u8981\u6709\u4e24\u79cd\uff1a
\n-b a \uff1a\u8868\u793a\u4e0d\u8bba\u662f\u5426\u4e3a\u7a7a\u884c\uff0c\u4e5f\u540c\u6837\u5217\u51fa\u884c\u53f7(\u7c7b\u4f3c cat -n)\uff1b
\n-b t \uff1a\u5982\u679c\u6709\u7a7a\u884c\uff0c\u7a7a\u7684\u90a3\u4e00\u884c\u4e0d\u8981\u5217\u51fa\u884c\u53f7(\u9ed8\u8ba4\u503c)\uff1b
\n-n \uff1a\u5217\u51fa\u884c\u53f7\u8868\u793a\u7684\u65b9\u6cd5\uff0c\u4e3b\u8981\u6709\u4e09\u79cd\uff1a
\n-n ln \uff1a\u884c\u53f7\u5728\u8367\u5e55\u7684\u6700\u5de6\u65b9\u663e\u793a\uff1b
\n-n rn \uff1a\u884c\u53f7\u5728\u81ea\u5df1\u680f\u4f4d\u7684\u6700\u53f3\u65b9\u663e\u793a\uff0c\u4e14\u4e0d\u52a0 0 \uff1b
\n-n rz \uff1a\u884c\u53f7\u5728\u81ea\u5df1\u680f\u4f4d\u7684\u6700\u53f3\u65b9\u663e\u793a\uff0c\u4e14\u52a0 0 \uff1b
\n-w \uff1a\u884c\u53f7\u680f\u4f4d\u7684\u5360\u7528\u7684\u4f4d\u6570\u3002
\n\u5b9e\u4f8b\u4e00\uff1a\u7528 nl \u5217\u51fa \/etc\/issue \u7684\u5185\u5bb9<\/p>\n

[root@www ~]# nl \/etc\/issue\r\n     1  CentOS release 6.4 (Final)\r\n     2  Kernel \\r on an \\m<\/pre>\n
more<\/strong><\/div>\n

\u4e00\u9875\u4e00\u9875\u7ffb\u52a8<\/p>\n

[root@www ~]# more \/etc\/man_db.config \r\n#\r\n# Generated automatically from man.conf.in by the\r\n# configure script.\r\n#\r\n# man.conf from man-1.6d\r\n....(\u4e2d\u95f4\u7701\u7565)....\r\n--More--(28%)  < == \u91cd\u70b9\u5728\u8fd9\u4e00\u884c\u5594\uff01\u4f60\u7684\u5149\u6807\u4e5f\u4f1a\u5728\u8fd9\u91cc\u7b49\u5f85\u4f60\u7684\u547d\u4ee4<\/pre>\n

\u5728 more \u8fd9\u4e2a\u7a0b\u5e8f\u7684\u8fd0\u884c\u8fc7\u7a0b\u4e2d\uff0c\u4f60\u6709\u51e0\u4e2a\u6309\u952e\u53ef\u4ee5\u6309\u7684\uff1a<\/p>\n

\u7a7a\u767d\u952e (space)\uff1a\u4ee3\u8868\u5411\u4e0b\u7ffb\u4e00\u9875\uff1b
\nEnter \uff1a\u4ee3\u8868\u5411\u4e0b\u7ffb\u300e\u4e00\u884c\u300f\uff1b
\n\/\u5b57\u4e32 \uff1a\u4ee3\u8868\u5728\u8fd9\u4e2a\u663e\u793a\u7684\u5185\u5bb9\u5f53\u4e2d\uff0c\u5411\u4e0b\u641c\u5bfb\u300e\u5b57\u4e32\u300f\u8fd9\u4e2a\u5173\u952e\u5b57\uff1b
\n:f \uff1a\u7acb\u523b\u663e\u793a\u51fa\u6863\u540d\u4ee5\u53ca\u76ee\u524d\u663e\u793a\u7684\u884c\u6570\uff1b
\nq \uff1a\u4ee3\u8868\u7acb\u523b\u79bb\u5f00 more \uff0c\u4e0d\u518d\u663e\u793a\u8be5\u6587\u4ef6\u5185\u5bb9\u3002
\nb \u6216 [ctrl]-b \uff1a\u4ee3\u8868\u5f80\u56de\u7ffb\u9875\uff0c\u4e0d\u8fc7\u8fd9\u52a8\u4f5c\u53ea\u5bf9\u6587\u4ef6\u6709\u7528\uff0c\u5bf9\u7ba1\u7ebf\u65e0\u7528\u3002<\/p>\n

less<\/strong><\/div>\n

\u4e00\u9875\u4e00\u9875\u7ffb\u52a8\uff0c\u4ee5\u4e0b\u5b9e\u4f8b\u8f93\u51fa\/etc\/man.config\u6587\u4ef6\u7684\u5185\u5bb9\uff1a<\/p>\n

[root@www ~]# less \/etc\/man.config\r\n#\r\n# Generated automatically from man.conf.in by the\r\n# configure script.\r\n#\r\n# man.conf from man-1.6d\r\n....(\u4e2d\u95f4\u7701\u7565)....\r\n:   < == \u8fd9\u91cc\u53ef\u4ee5\u7b49\u5f85\u4f60\u8f93\u5165\u547d\u4ee4\uff01<\/pre>\n

less\u8fd0\u884c\u65f6\u53ef\u4ee5\u8f93\u5165\u7684\u547d\u4ee4\u6709\uff1a<\/p>\n

\u7a7a\u767d\u952e \uff1a\u5411\u4e0b\u7ffb\u52a8\u4e00\u9875\uff1b
\n[pagedown]\uff1a\u5411\u4e0b\u7ffb\u52a8\u4e00\u9875\uff1b
\n[pageup] \uff1a\u5411\u4e0a\u7ffb\u52a8\u4e00\u9875\uff1b
\n\/\u5b57\u4e32 \uff1a\u5411\u4e0b\u641c\u5bfb\u300e\u5b57\u4e32\u300f\u7684\u529f\u80fd\uff1b
\n?\u5b57\u4e32 \uff1a\u5411\u4e0a\u641c\u5bfb\u300e\u5b57\u4e32\u300f\u7684\u529f\u80fd\uff1b
\nn \uff1a\u91cd\u590d\u524d\u4e00\u4e2a\u641c\u5bfb (\u4e0e \/ \u6216 ? \u6709\u5173\uff01)
\nN \uff1a\u53cd\u5411\u7684\u91cd\u590d\u524d\u4e00\u4e2a\u641c\u5bfb (\u4e0e \/ \u6216 ? \u6709\u5173\uff01)
\nq \uff1a\u79bb\u5f00 less \u8fd9\u4e2a\u7a0b\u5e8f\uff1b<\/p>\n

head<\/strong><\/div>\n

\u53d6\u51fa\u6587\u4ef6\u524d\u9762\u51e0\u884c<\/p>\n

\u8bed\u6cd5\uff1a<\/p>\n

head [-n number] \u6587\u4ef6<\/pre>\n

\u9009\u9879\u4e0e\u53c2\u6570\uff1a<\/p>\n

-n \uff1a\u540e\u9762\u63a5\u6570\u5b57\uff0c\u4ee3\u8868\u663e\u793a\u51e0\u884c\u7684\u610f\u601d<\/p>\n

[root@www ~]# head \/etc\/man.config<\/pre>\n

\u9ed8\u8ba4\u7684\u60c5\u51b5\u4e2d\uff0c\u663e\u793a\u524d\u9762 10 \u884c\uff01\u82e5\u8981\u663e\u793a\u524d 20 \u884c\uff0c\u5c31\u5f97\u8981\u8fd9\u6837\uff1a<\/p>\n

[root@www ~]# head -n 20 \/etc\/man.config<\/pre>\n
tail<\/strong><\/div>\n

\u53d6\u51fa\u6587\u4ef6\u540e\u9762\u51e0\u884c<\/p>\n

\u8bed\u6cd5\uff1a<\/p>\n

tail [-n number] \u6587\u4ef6<\/pre>\n

\u9009\u9879\u4e0e\u53c2\u6570\uff1a<\/p>\n

-n \uff1a\u540e\u9762\u63a5\u6570\u5b57\uff0c\u4ee3\u8868\u663e\u793a\u51e0\u884c\u7684\u610f\u601d
\n-f \uff1a\u8868\u793a\u6301\u7eed\u4fa6\u6d4b\u540e\u9762\u6240\u63a5\u7684\u6863\u540d\uff0c\u8981\u7b49\u5230\u6309\u4e0b[ctrl]-c\u624d\u4f1a\u7ed3\u675ftail\u7684\u4fa6\u6d4b<\/p>\n

[root@www ~]# tail \/etc\/man.config\r\n# \u9ed8\u8ba4\u7684\u60c5\u51b5\u4e2d\uff0c\u663e\u793a\u6700\u540e\u7684\u5341\u884c\uff01\u82e5\u8981\u663e\u793a\u6700\u540e\u7684 20 \u884c\uff0c\u5c31\u5f97\u8981\u8fd9\u6837\uff1a\r\n[root@www ~]# tail -n 20 \/etc\/man.config<\/pre>\n","protected":false},"excerpt":{"rendered":"

\u7531\u7b2c\u4e00\u884c\u5f00\u59cb\u663e\u793a\u6587\u4ef6\u5185\u5bb9 \u8bed\u6cd5\uff1a cat [-AbEnTv] \u9009\u9879\u4e0e\u53c2\u6570\uff1a -A \uff1a\u76f8\u5f53\u65bc -vET \u7684\u6574\u5408\u9009 […]<\/p>\n","protected":false},"author":1470,"featured_media":160279,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-160117","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/160117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1470"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=160117"}],"version-history":[{"count":7,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/160117\/revisions"}],"predecessor-version":[{"id":160280,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/160117\/revisions\/160280"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/160279"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=160117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=160117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=160117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}