工作之命令小总结(8):more命令
2013-12-07 15:58
260 查看
more命令,功能类似cat,cat命令是整个文件内容从上到下显示在屏幕上的。more会以一页一页的显示方便使用者逐页浏览,而最基本的指令就是按空白键就往下一页显示,按b键就会往回一页显示,而且还有搜索字符串的功能。more命令从前向后读取文件,因此在启动时就加载整个文件。
【命令格式】
more[-dlfpcsu][-num][+/pattern][+linenum][file ...]
【命令功能】
more命令和cat的功能一样都是查看文件中的内容,但是有所不同的是more可以按页来查看文件的内容,还支持直接跳转行等功能。
【命令参数】
+n 从第n行开始显示
-n 定义屏幕大小为n行
+/pattern 在每个档案显示前搜索该字串(pattern),然后从该字串前两行之后开始显示
-c 从顶部清屏,然后显示
-d 提示“Press space to continue,‘q’ to quit”,禁用响铃功能
-l 忽略Ctrl+l(换页)字符
-p 通过清除窗口而不是滚屏来对文件进行换页,与-c选项相似
-s 把连续的多个空格显示为一行
-u 把文件内容中的下划线去掉
【常用操作命令】
Enter 向下n行,需要定义。默认为1行
Ctrl+F 向下滚动一屏
空格键 向下滚动一屏
ctrl+B 返回上一屏
= 输出当前行的行号
:f 输出文件名和当前行的行号
V 调用vi编辑器
!命令 调用shell,并执行命令
q 退出more
【实例展示】
每屏以三行的形式进行显示:
搜索文本中出现的第一个#,并显示输出:
与管道结合进行分页显示:
【命令格式】
more[-dlfpcsu][-num][+/pattern][+linenum][file ...]
【命令功能】
more命令和cat的功能一样都是查看文件中的内容,但是有所不同的是more可以按页来查看文件的内容,还支持直接跳转行等功能。
【命令参数】
+n 从第n行开始显示
-n 定义屏幕大小为n行
+/pattern 在每个档案显示前搜索该字串(pattern),然后从该字串前两行之后开始显示
-c 从顶部清屏,然后显示
-d 提示“Press space to continue,‘q’ to quit”,禁用响铃功能
-l 忽略Ctrl+l(换页)字符
-p 通过清除窗口而不是滚屏来对文件进行换页,与-c选项相似
-s 把连续的多个空格显示为一行
-u 把文件内容中的下划线去掉
【常用操作命令】
Enter 向下n行,需要定义。默认为1行
Ctrl+F 向下滚动一屏
空格键 向下滚动一屏
ctrl+B 返回上一屏
= 输出当前行的行号
:f 输出文件名和当前行的行号
V 调用vi编辑器
!命令 调用shell,并执行命令
q 退出more
【实例展示】
每屏以三行的形式进行显示:
[root@node1 ~]# more -3 my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock --More--(25%) #显示文本进度
搜索文本中出现的第一个#,并显示输出:
[root@node1 ~]# more +/# my.cnf ...skipping #输出标示 socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks #出现的第一个#号,显示前两行之后的内容 symbolic-links=0 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
与管道结合进行分页显示:
[root@node1 ~]# cat test.log | more PING 172.16.18.6 (172.16.18.6) 56(84) bytes of data. 64 bytes from 172.16.18.6: icmp_seq=1 ttl=64 time=0.407 ms 64 bytes from 172.16.18.6: icmp_seq=2 ttl=64 time=0.559 ms 64 bytes from 172.16.18.6: icmp_seq=3 ttl=64 time=0.485 ms 64 bytes from 172.16.18.6: icmp_seq=4 ttl=64 time=0.595 ms 64 bytes from 172.16.18.6: icmp_seq=5 ttl=64 time=0.610 ms 64 bytes from 172.16.18.6: icmp_seq=6 ttl=64 time=0.574 ms 64 bytes from 172.16.18.6: icmp_seq=7 ttl=64 time=0.887 ms 64 bytes from 172.16.18.6: icmp_seq=8 ttl=64 time=0.549 ms 64 bytes from 172.16.18.6: icmp_seq=9 ttl=64 time=0.447 ms 64 bytes from 172.16.18.6: icmp_seq=10 ttl=64 time=0.543 ms 64 bytes from 172.16.18.6: icmp_seq=11 ttl=64 time=0.552 ms 64 bytes from 172.16.18.6: icmp_seq=12 ttl=64 time=0.519 ms 64 bytes from 172.16.18.6: icmp_seq=13 ttl=64 time=0.627 ms 64 bytes from 172.16.18.6: icmp_seq=14 ttl=64 time=0.482 ms 64 bytes from 172.16.18.6: icmp_seq=15 ttl=64 time=0.560 ms 64 bytes from 172.16.18.6: icmp_seq=16 ttl=64 time=0.559 ms 64 bytes from 172.16.18.6: icmp_seq=17 ttl=64 time=0.561 ms 64 bytes from 172.16.18.6: icmp_seq=18 ttl=64 time=0.565 ms 64 bytes from 172.16.18.6: icmp_seq=19 ttl=64 time=0.528 ms 64 bytes from 172.16.18.6: icmp_seq=20 ttl=64 time=0.520 ms 64 bytes from 172.16.18.6: icmp_seq=21 ttl=64 time=0.620 ms 64 bytes from 172.16.18.6: icmp_seq=22 ttl=64 time=0.542 ms 64 bytes from 172.16.18.6: icmp_seq=23 ttl=64 time=0.573 ms 64 bytes from 172.16.18.6: icmp_seq=24 ttl=64 time=0.545 ms --More-- #这种显示方式会依照当前终端的显示空间来显示 [root@node1 ~]# cat test.log | more -5 PING 172.16.18.6 (172.16.18.6) 56(84) bytes of data. 64 bytes from 172.16.18.6: icmp_seq=1 ttl=64 time=0.407 ms 64 bytes from 172.16.18.6: icmp_seq=2 ttl=64 time=0.559 ms 64 bytes from 172.16.18.6: icmp_seq=3 ttl=64 time=0.485 ms 64 bytes from 172.16.18.6: icmp_seq=4 ttl=64 time=0.595 ms --More-- #这种是依照每页5行的方式进行显示 这种情况下可以使用Ctrl+F或空格键切换至下个五行,但是使用Ctrl+F会跳一行再进行显示下五行,而使用空格键会直接显示下个五行。使用回车键则直接会显示下一行。 #########使用空格键切换的情况####### [root@node1 ~]# cat test.log | more -5 PING 172.16.18.6 (172.16.18.6) 56(84) bytes of data. 64 bytes from 172.16.18.6: icmp_seq=1 ttl=64 time=0.407 ms 64 bytes from 172.16.18.6: icmp_seq=2 ttl=64 time=0.559 ms 64 bytes from 172.16.18.6: icmp_seq=3 ttl=64 time=0.485 ms 64 bytes from 172.16.18.6: icmp_seq=4 ttl=64 time=0.595 ms 64 bytes from 172.16.18.6: icmp_seq=5 ttl=64 time=0.610 ms 64 bytes from 172.16.18.6: icmp_seq=6 ttl=64 time=0.574 ms 64 bytes from 172.16.18.6: icmp_seq=7 ttl=64 time=0.887 ms 64 bytes from 172.16.18.6: icmp_seq=8 ttl=64 time=0.549 ms 64 bytes from 172.16.18.6: icmp_seq=9 ttl=64 time=0.447 ms ##########使用Ctrl+F切换的情况###### 64 bytes from 172.16.18.6: icmp_seq=8 ttl=64 time=0.549 ms 64 bytes from 172.16.18.6: icmp_seq=9 ttl=64 time=0.447 ms ...skipping one line #跳一行 64 bytes from 172.16.18.6: icmp_seq=11 ttl=64 time=0.552 ms 64 bytes from 172.16.18.6: icmp_seq=12 ttl=64 time=0.519 ms 64 bytes from 172.16.18.6: icmp_seq=13 ttl=64 time=0.627 ms 64 bytes from 172.16.18.6: icmp_seq=14 ttl=64 time=0.482 ms 64 bytes from 172.16.18.6: icmp_seq=15 ttl=64 time=0.560 ms
相关文章推荐
- 总结工作中常用到的linux命令
- 日常工作总结(常用命令一)
- 工作中常用命令总结
- shell命令工作总结
- Liunx命令工作总结(2)
- [置顶] 总结工作中常用到的linux命令
- oracle工作学习随笔之常用命令及基本概念总结
- Linux中查看文本文件内容命令cat/tac/nl/more/less/head/tail/vi总结
- 总结工作中常用到的linux命令
- 工作之命令小总结(2):kill命令
- 工作总结,NTP协议和crontab命令
- Linux-命令-工作总结-对自己有用
- 关于工作中linux命令的一些总结
- Linux学习总结(31)——工作中常用的Linux脚本和命令
- 工作之命令小总结(4):netstat命令
- 工作之命令小总结(6):killall命令
- oracle常用命令(工作中总结)
- 工作中Linux 命令现总结
- Git 工作用到命令总结(不定时添加)
- mac 工作中命令总结