Less
Function Description: less is similar to more, but less can be used to browse files at will, while more can only move forward, but cannot move backward, and less will not load the entire file before viewing. When using less, you can use the [pageup] [pagedown] and other key-press functions to access and view the file, making it easier to view the content of a file! In addition, you can have more search functions in less, not only to search down, but also to search up.
Command parameters:
-B <buffer size> set the buffer size
-E automatically leaves after the file is displayed.
-F forces special files to be opened, such as peripheral device codes, directories, and binary files.
-G only indicates the last keyword to be searched.
-I ignore the case when searching
-M: display the percentage of more commands.
-N: displays the row number of each row.
-O <File Name> stores less output content in the specified file
-Q: no warning sound is used.
-S: displays a row of empty rows.
The-S line will discard the excess part after a long time
-X <number> displays the tab key as a specified number space.
/String: the function of searching "string" down
? String: the "string" search function
N: Repeat the previous search (and/or? Related)
N: Repeat the previous search (and/or? Related)
B. Flip one page backwards.
D. Flip back half page
H. display the Help Page
Q: exit the less command
U scroll forward half page
Y: Scroll one row forward.
Space key to scroll a row
Enter key to scroll one page
[Pagedown]: Scroll down a page
[Pageup]: returns a page up.
Instance used:
(1) view the File Content
[Atong @ LiWenTong ~] $ Less 1.log
Testatong
Atong
Log (END) ---- if the-e parameter is added, the system automatically exits.
(2) view history and use less to Paging
[Atong @ LiWenTong ~] $ History | less
1 cat/etc/passwd
2 cat/etc/passwd
3 sed '1p'/etc/passwd
4 sed-n '1p'/etc/passwd
5 sed/etc/passwd
6 cat/etc/passwd | grep/sbin/nologin
7 cat/etc/passwd
8 cat/etc/group
Echo $ PATH
(3) view multiple files through less
[Atong @ LiWenTong ~] $ Less 1.log test.txt
Testatong
Atong
Log (file 1 of 2) (END)-Next: test.txt
Enter ": n" and switch to log2014.log ---. You can perform text operations in two files.
Enter ": p" and switch to log2013.log.
(4) use: e to open another file during Query
Less file1
: E file2
--------------------------------- Subsequent self-Summary ------------------------------
The less and more functions are the same. They are all used for content display. The difference is already mentioned in this article. Less pages can be performed, and/can also be searched. N to search up and down, and-N to display the row number.