每天一个Linux命令(12)more命令
more命令是一个基于vi编辑器文本过滤器,它以全屏幕的方式按页显示文本文件的内容,支持vi中的关键字定位操作。
该命令一次显示一屏文本,满屏后停下来,并且在屏幕的底部出现一个提示信息,给出至今己显示的该文件的百分比:
--More--(XX%)可以用下列不同的方法对提示做出回答:
按Space键: 显示文本的下一屏内容。
按Enier键: 只显示文本的下一行内容。 按斜线符|:接着输入一个模式,可以在文本中寻找下一个相匹配的模式。
按H键: 显示帮助屏,该屏上有相关的帮助信息。
按B键: 显示上一屏内容。
按Q键: 退出more命令。
Ctrl+Z: 退出命令
(1)用法:
用法: more [-dlfpcsu ] [-num ] [+/ pattern] [+ linenum] [file ... ]
more [选项] [文件]
(2)功能:
功能:查看文件文档中的内容(支持按页查看和直接跳转行)
(3)选项参数:
1) -<数字>: 指定每屏显示的行数[-num]
2) -d: 显示“[press space to continue,'q' to quit.]”和“[Press 'h' for instructions]”
3) -c: 不进行滚屏操作。每次刷新这个屏幕
4) -s: 将多个空行压缩成一行显示
5) -u: 禁止下划线
6) +<数字>: 从指定数字的行开始显示[+linenum]
7) +/pattern: 在每个档案显示前搜寻该字串(pattern),然后从该字串前两行之后开始显示
(4)实例:
1)[sunjimeng@localhost Documents]$ more -dc more_text1 显示文件more_text1的内容,但在显示之前先清屏,并且在屏幕的最下方显示完核的百分比。
[sunjimeng@localhost ~]$ cd Documents
[sunjimeng@localhost Documents]$ ll
总用量
-rw-r--r--. root root 5月 : more_text1
[sunjimeng@localhost Documents]$ more -dc more_text1
执行过以后,屏幕只剩下:
I am studing orders of Linux!
I am trying to write as many as lines of text! No matter how low you consider yourself,
there is always someone looking behind you,
hoping that they were that high! Something you want keep all the time,always you will lose! Never forget to say "thanks"! Hppay today,also,prepared for happiness in the future! Don't aim your success if you want it,just do what you love and believe and fina
lly you will success! Maybe you can be laze man like a pig,but you can't feel free as it! I am a college school student!
I am planning to live and work in hangzhou or guangzhou!
I am from hefei anhui!
Enough,I have write too many words!
[sunjimeng@localhost Documents]$
上面的是终端窗口比较大的情况,所有内容能完全显示,下面是显示不完全的情况:
I am studing orders of Linux!
I am trying to write as many as lines of text! No matter how low you consider yourself,
there is always someone looking behind you,
hoping that they were that high! Something you want keep all the time,always you will lose! Never forget to say "thanks"! Hppay today,also,prepared for happiness in the future!
--More--(%)[Press space to continue, 'q' to quit.] //在这里显示百分比
2)[sunjimeng@localhost Documents]$ more -10 more_text1 显示文件more_text1的内容,每10行显示一次,而且在显示之前先清屏。
[sunjimeng@localhost Documents]$ more - more_text1
I am studing orders of Linux!
I am trying to write as many as lines of text! No matter how low you consider yourself,
there is always someone looking behind you,
hoping that they were that high! Something you want keep all the time,always you will lose!
3)[sunjimeng@localhost Documents]$ more +4 -10 more_text1 从第4行开始显示,每页显示10行
[sunjimeng@localhost Documents]$ more -d - more_text1
I am studing orders of Linux!
I am trying to write as many as lines of text! No matter how low you consider yourself,
there is always someone looking behind you,
hoping that they were that high! Something you want keep all the time,always you will lose! --More--(%)[Press space to continue, 'q' to quit.] //在这里我按了h键,弹出命令的参考。
Most commands optionally preceded by integer argument k. Defaults in brackets.
Star (*) indicates argument becomes new default.
-------------------------------------------------------------------------------
<space> Display next k lines of text [current screen size]
z Display next k lines of text [current screen size]*
<return> Display next k lines of text []*
d or ctrl-D Scroll k lines [current scroll size, initially ]*
q or Q or <interrupt> Exit from more
s Skip forward k lines of text []
f Skip forward k screenfuls of text []
b or ctrl-B Skip backwards k screenfuls of text []
' Go to place where previous search started
= Display current line number
/<regular expression> Search for kth occurrence of regular expression []
n Search for kth occurrence of last r.e []
!<cmd> or :!<cmd> Execute <cmd> in a subshell
v Start up /usr/bin/vi at current line
ctrl-L Redraw screen
:n Go to kth next file []
:p Go to kth previous file []
:f Display current file name and line number
. Repeat previous command
-------------------------------------------------------------------------------
和上面的对比可知,此时显示的也是10行,但第一行的内容和上面第一行的不一样
[sunjimeng@localhost Documents]$ more + - more_text1 No matter how low you consider yourself,
there is always someone looking behind you,
hoping that they were that high! Something you want keep all the time,always you will lose! Never forget to say "thanks"! Hppay today,also,prepared for happiness in the future!
--More--(%) //上面的百分比是38%
4)[sunjimeng@localhost Documents]$ more +/Never more_text1 找到Never字符串所在的行,然后从此行显示,之前的跳过
[sunjimeng@localhost Documents]$ more more_text1 //先查看文档中的所有文本数据
I am studing orders of Linux!
I am trying to write as many as lines of text! No matter how low you consider yourself,
there is always someone looking behind you,
hoping that they were that high! Something you want keep all the time,always you will lose! Never forget to say "thanks"! Hppay today,also,prepared for happiness in the future! Don't aim your success if you want it,just do what you love and believe and finally you will success! Maybe you can be laze man like a pig,but you can't feel free as it! I am a college school student!
I am planning to live and work in hangzhou or guangzhou!
I am from hefei anhui!
Enough,I have write too many words! //命令详解从这里开始
[sunjimeng@localhost Documents]$ more +/Never more_text1 ...跳过
Something you want keep all the time,always you will lose! Never forget to say "thanks"! Hppay today,also,prepared for happiness in the future! Don't aim your success if you want it,just do what you love and believe and finally you will success! Maybe you can be laze man like a pig,but you can't feel free as it! I am a college school student!
I am planning to live and work in hangzhou or guangzhou!
I am from hefei anhui!
Enough,I have write too many words!
5)[sunjimeng@localhost Documents]$ cat -n more_text1 |more -10 more命令通常和管道|结合起来使用,配合cat命令带有特定格式输出
[sunjimeng@localhost Documents]$ cat -n more_text1 |more -
I am studing orders of Linux!
I am trying to write as many as lines of text! No matter how low you consider yourself,
there is always someone looking behind you,
hoping that they were that high! Something you want keep all the time,always you will lose! --More--
6)[sunjimeng@localhost Documents]$ ls -l / | more -5 列一个目录下的文件,由于内容太多,我们应该学会用more来分页显示。这得和管道 | 结合起来。
[sunjimeng@localhost Documents]$ ls -l / | more -
总用量
lrwxrwxrwx. root root 5月 : bin -> usr/bin
dr-xr-xr-x. root root 5月 : boot
drwxr-xr-x. root root 5月 : dev
drwxr-xr-x. root root 5月 : etc
--more--
说明: 每页显示5个文件信息,按 Ctrl+F 或者 空格键 将会显示下5条文件信息。
(5)其他:
常用操作命令
Enter 向下n行,需要定义。默认为1行
Ctrl+F 向下滚动一屏
空格键 向下滚动一屏
Ctrl+B 返回上一屏
= 输出当前行的行号
f 输出文件名和当前行的行号
V 调用vi编辑器
!命令 调用Shell,并执行命令
q 退出more
每天一个Linux命令(12)more命令的更多相关文章
- 每天一个linux命令(12):more命令
1.命令简介 more (more) 该命令一次显示一屏文本,满屏后停下来,并且在屏幕的底部出现一个提示信息,给出至今己显示的该文件的百分比,方便逐页阅读(file perusal filter fo ...
- linux常用命令(12)head命令
head 与 tail 就像它的名字一样的浅显易懂,它是用来显示开头或结尾某个数量的文字区块,head 用来显示档案的开头至标准输出中,而 tail 想当然尔就是看档案的结尾.1 命令格式head [ ...
- 每天一个linux命令12之top
top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器.下面详细介绍它的使用方法.top是一个动态显示过程,即可以通过用户按键来不断刷新 ...
- 每天一个linux命令:nl(12)
nl nl命令读取 file 参数(缺省情况下标准输入),计算输入中的行号,将计算过的行号写入标准输出.在输出中,nl命令根据您在命令行中指定的标志来计算左边的行.输入文本必须写在逻辑页中.每个逻辑页 ...
- 每天一个linux命令(12):nl命令
版权声明更新:2017-05-16博主:LuckyAlan联系:liuwenvip163@163.com声明:吃水不忘挖井人,转载请注明出处! 1 文章介绍 本文介绍了Linux下面的mv命令. 2. ...
- 每天一个 Linux 命令(21):find命令之xargs
在使用 find命令的-exec选项处理匹配到的文件时, find命令将所有匹配到的文件一起传递给exec执行.但有些系统对能够传递给exec的命令长度有限制,这样在find命令运行几分钟之后,就会出 ...
- 每天一个linux命令(46):vmstat命令
vmstat是Virtual Meomory Statistics(虚拟内存统计)的缩写,可对操作系统的虚拟内存.进程.CPU活动进行监控.他是对系统的整体情况进行统计,不足之处是无法对某个进程进行深 ...
- 每天一个linux命令目录
出处:http://www.cnblogs.com/peida/archive/2012/12/05/2803591.html 开始详细系统的学习linux常用命令,坚持每天一个命令,所以这个系列为每 ...
- 每天一个linux命令(54):ping命令
Linux系统的ping命令是常用的网络命令,它通常用来测试与目标主机的连通性,我们经常会说“ping一下某机器,看是不是开着”.不能打开网页时会说“你先ping网关地址192.168.1.1试试”. ...
- 每天一个linux命令(58):telnet命令
telnet命令通常用来远程登录.telnet程序是基于TELNET协议的远程登录客户端程序.Telnet协议是TCP/IP协议族中的一员,是Internet远程登陆服务的标准协议和主要方式.它为用户 ...
随机推荐
- Android——点击对话框上button不关闭对话框
有时候我没可能须要在点击button进行一些检測.可是并不想关闭次对话框(系统默认点击不论什么一个button则关闭对话框),处理方法例如以下:在点击事件下加入例如以下代码: try { Field ...
- zabbix自动发现监控远程端口
zabbix监控远程服务器端口,simple checks是zabbix用来监控无agent的主机 脚本和模板地址: https://github.com/mikeluwen/tcpmonitor
- Extjs4 Combobox 联动始终出现loading错误的解决的方法
当反复选者combobox 联动时,下级的Combobox 会出现loading的错误表现形式,尽管Store数据已载入完也是一样. 废话少说贴代码就知道怎样处理了:(注意红色部分的关键语句) }, ...
- MBA人物俞洪敏:亿万富翁的生活表
我的智商非常一般,就是比别人勤奋.我的脑袋不属于特别笨的那种,但肯定也不是顶尖聪明的类型.在北大的50个同学当中,我的智商应该属于中下水平,这说明我不是顶尖高智商. 我的勤奋一般人跟不上.我平均每天工 ...
- 跟我一起写 Makefile(二)[转]
原文链接 http://bbs.chinaunix.net/thread-408225-1-1.html(出处: http://bbs.chinaunix.net/) 一.Makefile里有什么? ...
- getOutputStream() has already been called for this response的解决方法
1.问题描述:spring mvc中下载文件结束后,跳转到list页面,问题报上面的异常. 2.原因:写文件的时候response调用一次,在跳转的时候,spring调用ActionForward类中 ...
- find 多文件查找需要单引号
[root@db01 local]# find -name '*.com'|xargs egrep "qq"./tt.com:qq[root@db01 local]# find ...
- Linux的各个文件夹名称解释(FHS)
对于接触和已经接触过一段时间Linux的使用者来说,系统的各个文件夹名字还是挺让人费解的,什么etc,usr,var等等,大部分也是耳濡目染才有一个大概的概念,例如usr是存放自己编译安装的软件,et ...
- 通过Lock对象以及Condition对象实现多线程同步
通过Lock对象以及Condition对象实现多线程同步: 在之前的学习中,无论是通过synchronized建立同步代码块,还是通过synchronized建立同步函数,都是把对象看成一把锁来实现同 ...
- 一般处理程序页ashx 序列化 Json数组
json传递数组到一般处理程序页,序列化为实体类的方法,可以解决.ENT framework 3.5以前的项目, 3.5以后的项目可以用System.ServiceModel.Web和System.R ...