Linux command —-— less

Source: Internet
Author: User

  1. Command format:

    Less [options] File

  2. Command function:

    for easier viewing of files, the less command is very powerful and involves many options and operations commands

  3.       -E   leave automatically when the file display ends

    -G   Only the last keyword to search

          -M   show percentages when viewing

          -S   displays contiguous blank lines as one line

  4. Common operation commands: (commands to use when you open a file with less)

    /keyword search down "keywords"

    keyword search up "keywords"

    & Keywords only show lines with "keywords"

    n Repeat last search (with/and?) Related to use)

    N Repeat the previous search, showing the reverse order of n (with/and?). Related to use)

    u turn up half page

    b turn up one page

    d turn down half a page

    space down one page

    g go to the first line

    G go to the last line

    ↑ Scroll up one line

    ↓ Scroll down one line

    v Open VI Editor

  5. Common examples:

    Example one: Using less to view a file

    Command: less file

    Example two: View the command input history and display it with less paging

    Command: History | Less

    Example three: viewing multiple files simultaneously, such as File1, File2, File3

    Command: less file1 file2 file3

    Note: When viewing multiple files at the same time, you need to switch the file, in the less display page from the previous file switch to the next file input ": N", switch from the current file to the previous file input ": P"

    Example four: Use the less command to view and modify file files

    Command: less file in input v

    Note: When you use less to view a file, you need to modify to enter "v" in the less display page, switch vi Editor to edit and modify

    Example five: Display only lines with the keyword "Zhe" in the file files

    Command: less file enter & keyword

    Note: When using the less command to view a file, if you want to display only the line of a keyword, just use less to open the file, enter "& keyword " in it

    Example six: Using the less command to view large files can also be used to mark the location of the current check to see, to facilitate reading

    Command: less file enter mafter entering, then enter the name you want to edit such as "a"

    Description: When you view a file with the less command, use the command "m", add a tag, enter "m", and then enter a name to mark, such as "a", and when you want to view the marker position again, enter "a "to return to this tag, and to mark multiple places of the file, just mark the tag with the same name.

This article is from the "Shiyu" blog, make sure to keep this source http://928004321.blog.51cto.com/10707688/1731218

Linux command —-— less

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.