more和less:分页显示文件内容

2019-12-11  本文已影响0人  August________

more:分页显示文件内容

选项说明

参数选项 解释说明
-num 指定屏幕显示大小为num行
+num 从行号num开始显示
-s 把连续多个空行显示为一行
-p 不滚屏,而是清除整个屏幕,然后显示整个文本
-c 不滚屏,而是从每一屏的顶部开始显示文本

使用范例

#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
----<sinp>----
#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%)

#more +777 /etc/services
ris             180/tcp                 # Intergraph
ris             180/udp                 # Intergraph
unify           181/tcp                 # Unify
unify           181/udp                 # Unify
audit           182/tcp                 # Unisys Audit SITP
audit           182/udp                 # Unisys Audit SITP
----<sinp>----
#ls /etc/ | more -10
adjtime
aliases
aliases.db
alternatives
anacrontab
asound.conf
audisp
audit
avahi
bash_completion.d

less:分页显示文件内容

,而是根据需求来加载文件内容

选项参数

参数选项 解释说明
-i 搜索时忽略大小写
-m 显示类似于more的进度的百分比
-N 显示每行的行号
-s 将连续的空行压缩为一行
-e 当文件显示到最后一行时自动退出

使用范例

#less -N /etc/services
      1 # /etc/services:
      2 # $Id: services,v 1.55 2013/04/14 ovasik Exp $
      3 #
      4 # Network services, Internet style
      5 # IANA services version: last updated 2013-04-10
      6 #
      7 # Note that it is presently the policy of IANA to assign a single well-known
      8 # port number for both TCP and UDP; hence, most entries here have two entries
      9 # even if the protocol doesn't support UDP operations.
     10 # Updated from RFC 1700, ``Assigned Numbers'' (October 1994).  Not all ports
#ls /etc/ | less
adjtime
aliases
aliases.db
alternatives
anacrontab
asound.conf
audisp
audit
avahi
bash_completion.d
bashrc
----<sinp>----
上一篇 下一篇

猜你喜欢

热点阅读