Linux Command details-less command, linux Command details less

Source: Internet
Author: User

Linux Command details-less command, linux Command details less

In Linux, there is also a command similar to the more command-less command, which is more flexible and powerful than the more command. Today we will introduce the less command in Linux.

For more information about Linux commands, see the quick query manual for Linux commands.

The less command is similar to the more command, but the less command can browse the file more freely, and the less command will not load the entire file before viewing.

Compared with the more command, many prefer the less command.

I. Linux less command syntax
Less [parameter] File

The less command is very powerful. Here we only introduce several common parameters. For more parameters, use man less to view the Linux help manual.

-B <buffer size> set the buffer size-e when the file is displayed, the system automatically leaves-f to force the special file to open, for example, the peripheral device code, directory, and binary file-g only mark the last search keyword-I ignore the case when the search-m shows the percentage similar to the more command-N shows the row number-o <File Name> Save less output content in the specified file-Q does not use warning sound-s to display consecutive null behavior a row-S will discard the excess part for a long time-x <number> display the "tab" key as a specified number space/string: search down for the "string" function? String: the function of searching "string" up n: Repeat the previous search (and/or? Related) N: Repeat the previous search (and/or? () B flip one page backward d flip half page h display help interface Q exit less command u scroll forward half page y scroll forward one line space key scroll one line enter key scroll one page [pagedown]: scroll down a page [pageup]: Scroll up a page
Ii. Linux less command using instances

1) view files

$less linuxdaxue.com-access_log120.26.216.168 - - [12/Jun/2016:03:09:16 +0800] "HEAD / HTTP/1.1" 200 -42.96.189.63 - - [12/Jun/2016:03:09:41 +0800] "HEAD / HTTP/1.1" 200 -123.56.138.37 - - [12/Jun/2016:03:12:52 +0800] "HEAD / HTTP/1.1" 200 -120.26.216.168 - - [12/Jun/2016:03:14:16 +0800] "HEAD / HTTP/1.1" 200 -42.96.189.63 - - [12/Jun/2016:03:14:41 +0800] "HEAD / HTTP/1.1" 200 -linuxdaxue.com-access_log

2) view multiple files at a time

#less linuxdaxue.com-access_log linuxdaxue.com-error_log120.26.216.168 - - [12/Jun/2016:03:09:16 +0800] "HEAD / HTTP/1.1" 200 -42.96.189.63 - - [12/Jun/2016:03:09:41 +0800] "HEAD / HTTP/1.1" 200 -123.56.138.37 - - [12/Jun/2016:03:12:52 +0800] "HEAD / HTTP/1.1" 200 -120.26.216.168 - - [12/Jun/2016:03:14:16 +0800] "HEAD / HTTP/1.1" 200 -42.96.189.63 - - [12/Jun/2016:03:14:41 +0800] "HEAD / HTTP/1.1" 200 -123.56.138.37 - - [12/Jun/2016:03:17:52 +0800] "HEAD / HTTP/1.1" 200 -linuxdaxue.com-access_log (file 1 of 2)

Note:
Input: n, switch to linuxdaxue.com-error_log
Enter p and switch to linuxdaxue.com-access_log.

Iii. Linux less commands

Next we will introduce some operation commands that are commonly used in less commands. I hope you can master them well.

1) split-screen navigation

Ctrl + F-move one screen forward ctrl + B-move one screen backward ctrl + D-move half screen forward ctrl + U-move half screen backward

2) single-row navigation

J-move one row forward k-move one row backward

3) Other navigation

G-Move to the last line g-Move to the first line

4) Other commands

V-use the configuration editor to edit the current file h-show less help document & pattern-only show matching mode lines, instead of the entire file q/ZZ-exit less command

5) Mark navigation

When you use less to view a file with a large amount of content, you can mark the file, and then navigate to the text location marked with a specific mark through the command, as shown below:

Ma-use a to mark the current position of text 'a-navigation to mark

 

Now, we will introduce the Linux less command to you first. The less command is very powerful. Here is just a brief introduction to you, more skillful understanding requires more exercises.

For more information about Linux commands, see the quick query manual for Linux commands.

  • Copyright:This site's original article, published four months ago by the Linux University (Linuxdaxue.com), contains 1957 words.
  • Reprinted Please note:Linux Command explanation-less command | Linux University

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.