TrumanWong

less

Split screen to flip up and down pages to browse file contents

Supplementary instructions

The function of less command is very similar to that of more. Both can be used to browse the contents of text files. The difference is that the less command allows users to browse files forward or backward, while the more command can only browse forward. When using the less command to display a file, use the PageUp key to page up and the PageDown key to page down. To exit the less program, press the Q key.

grammar

less(option)(parameter)

Options

-e: Automatically exit after the file content is displayed;
-f: Force display of files;
-g: Do not highlight all searched keywords, only display the currently displayed keywords to improve display speed;
-l: Ignore case differences when searching;
-N: Display the line number at the beginning of each line;
-s: Compress multiple consecutive blank lines into one line for display;
-S: Display longer content on a single line without wrapping;
-x<number>: Display TAB characters as a specified number of space characters.
-r: Able to display the set color.

Parameters

File: Specify the file to display content in split screen.

Example

sudo less /var/log/shadowsocks.log

/String: Function to search down "string"
?String: Function to search upward for "string"
n: continue searching backwards
N: search forward
b: turn one page backward
d: turn back half a page
u: scroll forward half a page
y: scroll forward one line
Q: Exit less command
Spacebar: Scroll one page
Enter key: scroll one line
[pagedown]: Scroll down one page
[pageup]: Scroll up one page
G: Move to the last line
g: move to the first line