Linux less command detailed

Source: Internet
Author: User

Less commands for viewing the contents of a file under Linux are roughly the following:
Cat     starts displaying the content from the first line, and all the content is output the TAC     displays the content in reverse from the last line and outputs everything more similar to the    actual file content of a page and one page based on the size of the window,    but its advantages can be page forward, And you can search for the character head    only to display the first few lines tail    only show the last few lines of NL      similar to cat-n, the output line number is displayed Tailf   similar to Tail-f
But one of our most commonly used features is more and Less:more:

is to start the file from the first line, according to the Output window size, the appropriate output file content. When a page cannot be fully output, you can use "enter" to turn down the line, with the "SPACEBAR" to page down. To exit the view page, press the "Q" key. In addition, more can be combined with the pipe symbol "|" (pipe), for example: Ls-al | More

More syntax: More file name enter down n rows, need to define, default to 1 lines, CTRL f scroll down one screen, spacebar to scroll down one screen, Ctrl B to return to previous screen, = output line number of current line, f output file name and line number of current line; v Call VI editor; command to invoke the shell and execute the command; Q exit more
Less features:

Less functions and more similar, but using more can not page forward, can only turn back, and less can switch arbitrarily, the following focus on the specific use of the less command:

Grammar:

parameter Description :

-B < buffer size > Set buffer Size-e When the file shows end, automatically leave-f force to open special files, such as peripheral code, directory and binary file-G only flag last search keyword-I ignore search case-m show a percentage like more command-n Displays the line number of each row-o < file name > save less output in the specified file-Q does not use the warning tone-s to display continuous empty behavior a row-s line too long will be out of the partial discard-x < number > the "tab" key is displayed as a specified number of spaces/ String: Search down the function of "string"? String: Search Up "string" function N: Repeat previous search (with/or?). About) N: Reverse Repeats the previous search (and/or?). About) b Turn back one page D back half page h Display Help interface Q exit less command U forward scroll half page forward scroll one line key scroll a page [PageDown]: Flip one page [PageUp]: Turn one page up
Additional Notes

1. Full Screen navigation

CTRL + F-Move forward one screen Ctrl + B-Move backward one screen Ctrl + D-Move forward half screen Ctrl + U-Move backward half screen

2. Single-line navigation

J-Move forward one line K-Move backward one line

3. Other navigation

G-Move to the last line G-move to the first line Q/zz-Exit less command

4. Other useful commands

V-Edit the current file with the configured Editor H-Show help document for less &pattern-displays only the lines of the matching pattern, not the entire file

5. 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 the current position of the A tag text ' A-navigate to mark a

Linux less command detailed

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.