One day a Linux base command to view the contents of the file less

Source: Internet
Author: User

Less View File contents

1 , command format

Less [options] file ...


2 command function

linux less commands are used primarily to browse the contents of a file, and more command is similar in usage, unlike more command, less command to go back to the part of the view .

Lesscompared to the use of Moremore resilient. In the More, we have no way to turn to the front,can only look back, but if used Less, you can use[PageUp]| [b][PageDown]| [Space]functions such as buttons to go back and forth to look at the file, more easily used to view the contents of a file! In addition, Lessinside you can have more search function, not only to search down, but also to search upward.

3 , command parameters

- I.: Ignore Case

Flip Screen:

space bar | [F] : Turn a screen at the end of the file;

b : Flip a screen to the file header;

Enter | [j] : Flip a line to the end of the file;

k : To flip a line to the file header;

D : Turn half screen at the end of the file;

u : Turn half screen to file header;

Text Search: Case sensitive

/keyword : Search the tail of the file;

? keyword : Search the file header;

                      N : The same direction as the search command ( next )

                      N : In the opposite direction of the search command ( previous )

&/pattern- displays only the rows of the matching pattern, not the entire file

Quick Jump:

                       quick jump to file header 1g | g Span style= "font-family: ' The song Body '; Color:rgb (51,51,51); background: #FFFFFF;" ;

                       quick jump to end of file g Span style= "font-family: ' The song Body '; Color:rgb (51,51,51); background: #FFFFFF;" ;

editing files using the vi Editor : v

Multiple files viewed at the same time

Lessfile1 file2 ...

: N Next File

:p Previous File

Tag Navigation

When you use less to view large files, you can mark them in any one place, and you can navigate to the text location labeled with a specific tag by command:

Ma- use A to mark the current position of the text

' A- Navigate to mark a

Exit file

q| ZZ: Exit;

4 , command instance:

1 , view files

command: Less test

[[email protected] ~]# cat test 123123456123[[email protected] ~]# less test 123123456123test (END)


Example 2 , multiple files are viewed at the same time

command: Less test test2

[[email protected] ~]# cat test Test2123123123456123234234234567[[email protected] ~]#[[email protected] ~]# less test tes T2123123123456123test (file 1 of 2) (END)-Next:test2[[email protected] ~]# less test test2123123123456123:n...skipping ... 234234234567test2 (file 2 of 2) (END)

Description

Input: N, switch to Test2

After entering: p, switch to test


This article is from "Linux rookie" blog, please be sure to keep this source http://geekb0y.blog.51cto.com/10743719/1883241

One day a Linux base command to view the contents of the file less

Related Article

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.