Linux more command - pagination of text files

Linux more command: pagination of text files

Linux more command Function Description

Use the more command to display the contents of a text file in pages. It is similar to the cat command, but it displays the contents of the file in a paginated manner so that the user can read it page by page.

Linux more command Syntax

more [Option] [File]

The meaning of each option in the command is shown in the table.

Option Description
-n Number of rows displayed at a time, n stands for number
-f Calculate the number of rows by the actual number of rows, not the number of rows after the automatic line feed
-p Instead of displaying each page in a scrolling manner, the screen is cleared before the content is displayed
-c Similar to the -p option, except that the content is displayed first and then the other old data is cleared
-s When more than two consecutive blank lines are encountered, replace them with one blank line
-u Do not show the lower quotation marks
+n Display the contents of the file starting from the nth line, n stands for the number

Linux more command Demo

Paging the contents of the file /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%)

Display the contents of the /root/testfile file page by page, with one blank line if there are more than two consecutive blank lines

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

Display the contents of the /root/testfile file starting at line 20

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

Show the contents of the /etc/passwd file two lines at a time

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

Related

Linux Login Logout Command
Linux login commandLinux logout commandLinux nologin commandLinux exit commandLinux sulogin commandLinux rlogin commandLinux poweroff commandLinux ctrlaltdel CommandLinux shutdown commandLinux halt commandLinux reboot commandLinux init commandLinux runlevel commandLinux telinit command
Linux File Management Command
Linux cat commandLinux tac commandLinux nl commandLinux more commandLinux less commandLinux head commandLinux tail commandLinux rev commandLinux fold commandLinux fmt commandLinux expand commandLinux pr commandLinux sort commandLinux uniq commandLinux cut commandLinux comm commandLinux diff commandLinux join commandLinux diff3 commandLinux cmp commandLinux colrm commandLinux paste commandLinux mkdir commandLinux tr commandLinux split commandLinux csplit commandLinux tee commandLinux unexpand commandLinux patch commandLinux awk commandLinux sed commandLinux od commandLinux pwd commandLinux cd commandLinux ls commandLinux dir commandLinux dirs commandLinux touch commandLinux rmdir commandLinux cp commandLinux mv commandLinux rm commandLinux install commandLinux tmpwatch commandLinux file commandLinux du commandLinux wc commandLinux tree commandLinux cksum commandLinux md5sum commandLinux sum commandLinux dirname commandLinux mkfifo Command
Cron Expressions
Cron Expression to Run Every Day at 12 PMUnderstanding Vue Cron ExpressionsUnderstanding JS Cron ExpressionsA Comprehensive Guide to Cron Expressions for Scheduled TasksUnderstanding Linux Cron ExpressionsUnderstanding Quartz Cron ExpressionsCron ExpressionCron Time ExpressionCron Expression ParsingCron Expression: Executing a Task Every SecondCron Expression for Every Minute ExecutionCron Expression to Execute Every 10 MinutesCron Expression: Executing Every HourCron Expression to Execute Once a YearCron Expression: How to Schedule a Task to Run Daily at Midnight?