Linux Learning Materials-more command

Source: Internet
Author: User
Tags log log

The more command, which functions like cat, the Cat command is the entire contents of the file displayed on the screen from top to bottom. More will be a page-by-page display to facilitate users to read pages, and the most basic instruction is to press the blank key (space) on the next page, press the B key will be back to a page, but also the function of the search string. The more command reads the file backwards from the front, so it loads the entire file at startup.

1. Command format:

more [-DLFPCSU] [-num] [+/pattern] [+ linenum] [file ...]

2. Command function:

The more commands and the cat function are the same view of the contents of the file, but the difference is that more can be viewed by the page to view the contents of the file, but also support the function of direct jump.

3. Command parameters:

+n starting from joys N rows

-N defines the screen size as n rows

+/pattern searches for the string before each file is displayed, and then starts from the first two lines of the string

-C clear the screen from the top and then display

-D hint "press space to continue, ' Q ' To quit (press SPACEBAR to continue, pressing Q key to exit)", disable the ringing function

-L ignores Ctrl+l (page break) characters

-p to page a file by clearing the window instead of scrolling, similar to the-C option

-S displays a contiguous number of empty rows as a row

-U Remove the line from the contents of the file

4. Common Operation Commands:

Enter down n rows, which need to be defined. Default is 1 rows

CTRL+F Scroll down one screen

Space bar scroll down one screen

Ctrl+b Back to previous screen

= Output the line number of the current line

: F output File name and line number of the current line

V Call VI Editor

command to invoke the shell and execute the command

Q Exit More

5. Command instance:

Example 1: Display the contents of the file from line 3rd

Command:

More +3 Log2012.log

Output:

[Root@localhost test]# Cat Log2012.log

2012-01

2012-02

2012-03

2012-04-day1

2012-04-day2

2012-04-day3


======[root@localhost test]# more +3 Log2012.log

2012-03

2012-04-day1

2012-04-day2

2012-04-day3


======[root@localhost test]#

Example 2: Find the first line from a file with the "Day3" string, and start displaying the output from the first two lines there

Command:

More +/day3 Log2012.log

Output:

[Root@localhost test]# more +/day3 Log2012.log

... skipping

2012-04-day1

2012-04-day2

2012-04-day3

2012-05

2012-05-day1


======[root@localhost test]#


Example 3: Set the number of rows per screen

Command:

More-5 Log2012.log

Output:

[Email protected] test]# more-5 Log2012.log

2012-01

2012-02

2012-03

2012-04-day1

2012-04-day2

Description

As shown, the bottom of the screen shows the content of the total number of files in proportion, press CTRL+F or SPACEBAR will display the next screen 5 content, the percentage will also change.

Example 4: Column A directory of files, because the content is too much, we should learn to use more to page display. This has to do with plumbing | Combined.

Command:

Ls-l | More-5

Output:

[Email protected] test]# Ls-l | More-5

Total 36

-rw-r--r--1 root root 308 11-01 16:49 Log2012.log

-rw-r--r--1 root root 10-28 16:54 Log2013.log

-rw-r--r--1 root root 127 10-28 16:51 Log2014.log

lrwxrwxrwx 1 root root 7 10-28 15:18 log_link.log log.log

-rw-r--r--1 root root 10-28 17:02 log.log

-rw-r--r--1 root root notoginseng 10-28 17:07 log.txt

Drwxr-xr-x 6 root root 4096 10-27 01:58 SCF

DRWXRWXRWX 2 root root 4096 10-28 14:47 test3

DRWXRWXRWX 2 root root 4096 10-28 14:47 test4


Description

Each page shows 5 file information, press CTRL+F or SPACEBAR will display the next 5 file information.

Linux Learning Materials-more command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.