more命令,功能类似 cat ,cat命令是整个文件的内容从上到下显示在屏幕上。 more会以一页一页的显示方便使用者逐页阅读,而最基本的指令就是按空白键(space)就往下一页显示,按 b 键就会往回(back)一页显示,而且还有搜寻字串的功能 。more命令从前向后读取文件,因此在启动时就加载整个文件。

1.命令格式:

more [-dlfpcsu ] [-num ] [+/ pattern] [+ linenum] [file ... ]

2.命令功能:

more命令和cat的功能一样都是查看文件里的内容,但有所不同的是more可以按页来查看文件的内容,还支持直接跳转行等功能。

3.命令参数:

+n      从笫n行开始显示

-n       定义屏幕大小为n行

+/pattern 在每个档案显示前搜寻该字串(pattern),然后从该字串前两行之后开始显示

-c       从顶部清屏,然后显示

-d       提示“Press space to continue,’q’ to quit(按空格键继续,按q键退出)”,禁用响铃功能

-l        忽略Ctrl+l(换页)字符

-p       通过清除窗口而不是滚屏来对文件进行换页,与-c选项相似

-s       把连续的多个空行显示为一行

-u       把文件内容中的下画线去掉

4.常用操作命令:

Enter    向下n行,需要定义。默认为1行

Ctrl+F   向下滚动一屏

空格键  向下滚动一屏

Ctrl+B  返回上一屏

=       输出当前行的行号

:f     输出文件名和当前行的行号

V      调用vi编辑器

!命令   调用Shell,并执行命令

q       退出more

5.命令实例:

实例1:显示文件中从第3行起的内容

命令:

more +3 log2012.log

实例2:从文件中查找第一个出现"day3"字符串的行,并从该处前两行开始显示输出

命令:

more +/day3 log2012.log

实例3:设定每屏显示行数

more -5 log2012.log

说明:

最下面显示了该屏展示的内容占文件总行数的比例,按 Ctrl+F 或者 空格键 将会显示下一屏5条内容,百分比也会跟着变化。

实例4:列一个目录下的文件,由于内容太多,我们应该学会用more来分页显示。这得和管道 | 结合起来

命令:

ls -l  | more -5

说明:

每页显示5个文件信息,按 Ctrl+F 或者 空格键 将会显示下5条文件信息。

linux 'more' command.的更多相关文章

  1. Linux:-bash: ***: command not found

    Linux:-bash: ***: command not found,系统很多命令都用不了,均提示没有此命令. 突然之间linux很多命令都用不了,均提示没有此命令. 这应该是系统环境变量出现了问题 ...

  2. 12 Linux Which Command, Whatis Command, Whereis Command Examples

    This Linux tutorial will explain the three "W" commands. The three "W"s are what ...

  3. 【Linux】-NO.8.Linux.4.Command.1.001-【Common Command】-

    1.0.0 Summary Tittle:[Linux]-NO.8.Linux.4.Command.1.001-[Common Command]- Style:Linux Series:Command ...

  4. learn Linux sed command

    learn Linux sed command 一.参考文档: . sed命令详解 http://qifuguang.me/2015/09/21/sed%E5%91%BD%E4%BB%A4%E8%AF ...

  5. Linux cp command All In One

    Linux cp command All In One $ man cp $ cp -h # 强制 $ cp -f # 递归,复制文件夹 $ cp -r demos cp -fr # ./folder ...

  6. how to using Linux pipe command output another command's help content to a file

    how to using Linux pipe command output another command's help content to a file Linux tee > >& ...

  7. Changing the Color of Linux ls Command 改变Linux的ls命令显示的颜色

    Linux command ls basically use the file /etc/DIR_COLORS or /etc/DIR_COLORS.xterm to define the color ...

  8. linux net command /uboot command

    1. uboot command 读取寄存器内容 md [内存地址][长度] 修改内存地址 mw [内存地址][长度] 2. linux络命令  -- netstat -a (all)显示所有选项,默 ...

  9. Linux / Unix Command: bunzip2--reference

    http://linux.about.com/library/cmd/blcmdl1_bunzip2.htm NAME bzip2, bunzip2 - a block-sorting file co ...

  10. 10 Linux DIG Command Examples for DNS Lookup--reference

    by RAMESH NATARAJAN on FEBRUARY 29, 2012 http://www.thegeekstuff.com/2012/02/dig-command-examples/ D ...

随机推荐

  1. hdu 5063 Operation the Sequence

    http://acm.hdu.edu.cn/showproblem.php?pid=5063 思路:因为3查询最多50,所以可以在查询的时候逆操作找到原来的位置,然后再求查询的值. #include ...

  2. cf C. Dominoes

    http://codeforces.com/contest/394/problem/C 题意:有n*m个骨牌,每个骨牌上有四种样式(“01,10,11,00”),让你重新排列成一个N*M的矩阵,使2* ...

  3. 使用 HT 单片机芯片做触摸按键的试验:触摸按键实践一

    使用 HT 芯片做触摸按键,可供使用的专门用途芯片主要有:HT45R35,HT45R36,HT45R38,原来还有一个 45R34 ,不知道为何停止生产了.如果仅仅是为了按键功能,选择 45R35 觉 ...

  4. 【HDOJ】2405 Marbles in Three Baskets

    BFS+状态压缩. /* 2405 */ #include <iostream> #include <queue> #include <cstdio> #inclu ...

  5. Linux&shell 之Linux文件权限

    写在前面:案例.常用.归类.解释说明.(By Jim) Linux文件权限用户useradd test (添加用户test)userdel test (删除用户test)passwd test(修改用 ...

  6. A Simple problem

    http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2497 题意:给出顶点数,边数及节点s,判断s是 ...

  7. 【转】color颜色十六进制编码大全

    原文网址:http://blog.csdn.net/coder_pig/article/details/18262105 最近刚开始学web,发现好的颜色搭配可以让自己的网页更加美观, 中午不想做事, ...

  8. Using Apache Web Server with Jboss AS 7

    In real-world projects, it's common to find Apache web server as a front door to your application se ...

  9. Java Spring的 JavaConfig 注解

    序 传统spring一般都是基于xml配置的,不过后来新增了许多JavaConfig的注解.特别是springboot,基本都是清一色的java config,不了解一下,还真是不适应.这里备注一下. ...

  10. 转:spring mvc model.addAttribute页面c:forEach取不到

    原文链接:http://www.cnblogs.com/beautifulFuture/p/3957426.html spring mvc model.addAttribute页面c:forEach取 ...