Linux more命令

Linux more命令:分页显示文本文件

Linux more命令 功能描述

使用more命令可以分页显示文本文件的内容。类似于cat命令,不过是以分页方式显示文件内容,方便使用者逐页阅读。

Linux more命令 语法

more [选项] [文件]

命令中各选项的含义如表所示。

Linux more命令 语法

在使用more命令时,可以使用表所示的子命令。

Linux more命令 语法

Linux more命令 示例

分页显示文件/etc/services的内容

[root@rhel ~]# more /etc/services
# /etc/services:
# Id: services, v 1.482009/11/11 14:32:31 ovasik Exp
#
# Network services, Internet style
# IANA services version: last updated 2009-11-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.
#Updated from RFC 1700, ''Assigned Numbers''(October 1994). Not all ports
# are included, only the more common ones.
#
# The latest IANA port assignments can be gotten from
#   http://www.iana.org/assignments/port-numbers
# The Well Known Ports are those from 0 through 1023.
# The Registered Ports are those from 1024 through 49151
# The Dynamic and/or Private Ports are those from 49152 through 65535
#
# Each line describes one service, and is of the form:
#
#service-name port/protocol [aliases...] [#comment]
tcpmux      1/tcp                      #TCP port service multiplexer
tcpmux      1/udp                     #TCP port service multiplexer
rje          5/tcp                      #Remote Job Entry
rje          5/udp                     #Remote Job Entry
echo        7/tcp
echo        7/udp
discard      9/tcp       sink null
discard      9/udp       sink null
systat       11/tcp       users
systat       11/udp      users
daytime     13/tcp
daytime     13/udp
qotd        17/tcp      quote
qotd        17/udp      quote
msp        18/tcp                      #message send protocol
msp        18/udp                      #message send protocol
--More--(0%)

逐页显示/root/testfile文件内容,如有连续两行以上空白行则以一行空白行显示

[root@rhel ~]# more -s /root/testfile

从第20行开始显示/root/testfile文件的内容

[root@rhel ~]# more +20 /root/testfile

一次两行显示/etc/passwd文件的内容

[root@rhel ~]# more -2 /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
--More--(4%)

Camera课程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

办公软件教程

Linux教程

计算机教程

大数据教程

开发工具教程