说明
more命令是将文件内容一页一页的显示,跟cat相比,cat命令是将文件内容一次性输出到屏幕。
格式
more [option] [filename]
常用命令
- -num:指定屏幕显示大小为num行
- +num:从行号num开始显示
- -s:把连续的多个空行显示为一行
- -p:不滚屏,而是清楚整个屏幕,然后显示文本
- -c:不滚屏,而是从每一屏顶部开始显示文本,每显示完一行,就清楚这一行的剩余部分
交互命令
空格:下翻一屏
b:上翻一屏
/:搜索
=:输出当前行的行号
q:退出
示例
1、不使用任何参数
[root@localhost ~]# more /etc/services
# /etc/services:
# $Id: services,v 1.55 2013/04/14 ovasik Exp $
#
# Network services, Internet style
# IANA services version: last updated 2013-04-10
#
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, most entries here have two entries
# even if the protocol doesn't support UDP operations.
.....
--More--(0%)
2、定义显示的行数,不会满屏显示内容,而只显示5行
[root@localhost ~]# more -5 /etc/services
# /etc/services:
# $Id: services,v 1.55 2013/04/14 ovasik Exp $
#
# Network services, Internet style
# IANA services version: last updated 2013-04-10
--More--(0%)
3、从指定的行开始显示内容
[root@localhost ~]# more +999 /etc/services
ibm-app 385/tcp # IBM Application
ibm-app 385/udp # IBM Application
asa 386/tcp # ASA Message Router Object Def.
asa 386/udp # ASA Message Router Object Def.
aurp 387/tcp # Appletalk Update-Based Routing Pro.
aurp 387/udp # Appletalk Update-Based Routing Pro.
unidata-ldm 388/tcp # Unidata LDM
unidata-ldm 388/udp # Unidata LDM
uis 390/tcp # UIS
...
ncld 405/tcp # ncld
ncld 405/udp # ncld
imsp 406/tcp # Interactive Mail Support Protocol
--More--(8%)
4、使用管道分页显示目录内容
[root@localhost ~]# ls /etc/|more -10
adjtime
aliases
aliases.db
alternatives
anacrontab
asound.conf
audisp
audit
avahi
bash_completion.d
--More--