Linux also has a command very similar to the more command--less command, compared to the more command, less command more flexible and powerful, today we will introduce the less command under Linux.
For more information on Linux commands, see: Linux Command Quick check manual
The less command is very similar to the more command, but it is more casual to browse the file, and it does not load the entire file until it is viewed.
Many people prefer the less command compared to the more command.
First, Linux less command syntax
Less [parameter] file
The less command is very powerful, only a few common parameters are introduced here, and more parameters are used to view the Linux help manual using man less.
-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/strings: Search for "string" function? 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
Second, Linux less command use instance
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 once
#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 +08 XX] "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-linuxda Xue.com-access_log (file 1 of 2)
Description
Input: N, switch to Linuxdaxue.com-error_log
Enter: p, switch to Linuxdaxue.com-access_log
Third, the Linux less command common Operation command
Next, we will introduce some of the more commonly used commands in less command, I hope you can master.
1) Split-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 row
4) Other commands
V-Edit the current file with the configured editor H-shows the help document for less &pattern-shows only the lines of the matching pattern, not the entire file Q/zz-exit the NOT command
5) Tag Navigation
When you use less to view more files, you can make a tag, and then you can navigate to the text location labeled with a specific tag by command, as shown here:
Ma-Use A to mark the current position of the text ' A-navigate to mark a
All right, the relevant content of Linux Less command is first introduced here, less command is very powerful, here just for everyone to do a simple introduction, more skilled master still need everyone's more practice.
For more information on Linux commands, see: Linux Command Quick check manual
- Copyright Notice: original article, 4 months ago, published by the University of Linux (linuxdaxue.com), a total of 1957 words.
- reprint Please specify: Linux Command-less Command | Linux University
Linux Command-less command