Linux file Content Lookup

Source: Internet
Author: User

1. View the contents of the file directly

(1)Cat command , starting from the first line to display the contents of the file

-B, List line numbers, show only non-blank lines, blank lines without line numbers

-N, List line numbers, blank lines also have line numbers

(2)TAC command , from the last line to the first line in reverse on the screen display

(3)NL command , add line number print

- b, specifying the way the line number is specified, includes two types:

- B A, which indicates that the line number is listed whether it is a blank line or not

- b t, if there are blank lines, not listed

- n, which lists the method of line number display, including three kinds:

- N Ln, the line number is displayed on the left of the screen

- N RN, the line number is displayed to the right of the field and does not add 0

- n rz, line number is displayed on the right of the field, plus 0

- W, number of digits occupied by the line number field

2. Can flip view

(1) Morecommands , one page, one page flip

1) SPACEBAR (space), turn down one page

2) Enter, scroll down one line

3)/String, in the contents of this display, query down the "string" this keyword

4): F, immediately display the file name and the number of rows currently displayed

5) Q, leave more now and no longer display the contents of the file

6) B, page back, only useful for files

(2) Lesscommand , a page-by-page flip, more flexible than the more command

1) SPACEBAR (space), turn down one page

2) [PageDown], turn down one page

3) [PageUp], turn up one page

4)/String, down "string" this keyword

5) string, up "string" this keyword

6) N, repeat the previous query

7) N, reverse repeats the previous query

8) Q, leave less this program

3. Data selection

(1)Head command , remove the previous lines

- nnumber, showing the previous number line (default 10 rows)

Note that when number is negative (for example,-10), the following 10 rows are displayed

(2)tail command , remove the following lines

- nnumber, showing the following number line (default 10 rows)

Note that when number has a "+" (such as +100), it is indicated that it will be listed after 100 rows

Linux file Content Lookup

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.