1、简介
more 命令,功能类似 cat
cat 命令是将整个文件的内容从上到下显示在屏幕上
more 命令会一页一页的显示
按空白键(space)往下一页显示
按 b 键就会往回(back)一页显示
搜寻字串的功能
2、主要功能
向后读取文件,内容从上到下显示在屏幕上,因此在启动时就加载整个文件
3、用法/命令格式
more [选项] {文件}
4、常用参数解析
4.1 常用参数
语法
参数
说明
more {文件} … {文件N}
将文件的内容从上到下显示在屏幕上
4.2 常用操作
more 命令 显示 之后,会有一些 基本的操作
按键
说明
输出当前行的行号
q
退出 more
“空格键” 或者 “Ctrl + F” 组合键
向下滚动一屏
b
返回上一屏
5、辅助功能
5.1 行号显示
5.1.1 第n行 开始显示
语法
参数
说明
more +{number} {文件}
从笫 n 行开始显示
# more +3 /etc/hosts
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
5.1.2 输出 显示 n 行
语法
参数
说明
more -{number} {文件}
定义屏幕大小为 n 行
# more -3 /etc/hosts
127.0.0.1 localhost
127.0.1.1 ubuntu
5.1.3 连续空行显示 一行
语法
参数
说明
more -s {文件}
把连续的多个空行显示为一行
5.2 字符搜索
语法
参数
说明
more +/{string} {文件}
在每个档案显示前搜寻该字串(string),然后从该字串前两行之后开始显示
# more +/ff02 /etc/hosts
…skipping
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
5.3 清屏显示
语法
参数
说明
more -c {文件}
从顶部清屏,然后显示
more -p {文件}
通过清除窗口而不是滚屏来对文件进行换页,与-c 选项相似
5.4 提示 信息
语法
参数
说明
more -d {文件}
提示”Press space to continue,’q’ to quiet”,禁用响铃功能
5.5 去除 下划线
语法
参数
说明
more -u {文件}
把文件内容中的下画线去掉
# more -u /etc/hosts
127.0.0.1 localhost
127.0.1.1 ubuntu
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
转载请注明:XAMPP中文组官网 » Linux shell 操作命令 more