more指令
命令格式:
more [-dlfpcsu ] [-num ] [+/ pattern] [+ linenum] [file … ]
命令功能:
一页一页查看文件,按空白键(space)显示下一页,按 b 键就会显示上一页。
命令参数:
+n 从笫n行开始显示
-n 显示n行
+/pattern 在每个档案显示前搜寻该字串(pattern),然后从该字串前两行之后开始显示
在/var/log目录下新建test.log文件
[root@localhost log]# vim test.log
写入如下内容:
2017-08-01
2017-08-02
2017-08-03
2017-08-04
2017-08-05
2017-08-06
2017-08-07
2017-08-08
2017-08-09
2017-08-10
error
[root@localhost log]# more test.log
2017-08-01
2017-08-02
2017-08-03
2017-08-04
2017-08-05
2017-08-06
2017-08-07
2017-08-08
2017-08-09
2017-08-10
error
[root@localhost log]# more +3 test.log
2017-08-03
2017-08-04
2017-08-05
2017-08-06
2017-08-07
2017-08-08
2017-08-09
2017-08-10
error
[root@localhost log]# more -3 test.log
2017-08-01
2017-08-02
2017-08-03
[root@localhost log]# more +/error test.log
…跳过
2017-08-09
2017-08-10
error