Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux less command

Linux less command

Linux Command Reference Linux Command Reference

less is similar to more, but less lets you browse files freely, supporting paging and searching, as well as paging up and down.

Syntax

less [参数] 文件 

Parameter Description:

Example

1. View a file



less log2013.log

2. Use ps to view process information and page through it with less



ps -ef |less

3. View command history and page through it with less



[root@localhost test]# history | less

22  scp -r tomcat6.0.32 root@192.168.120.203:/opt/soft

23  cd ..

24  scp -r web root@192.168.120.203:/opt/

25  cd soft

26  ls

……省略……

4. Browse multiple files



less log2013.log log2014.log

Explanation:
After entering :n, switch to log2014.log
After entering :p, switch to log2013.log

Additional notes

1. Full-screen navigation

2. Single-line navigation

3. Other navigation

4. Other useful commands

5. Mark navigation

When using less to view a large file, you can mark any position and navigate via commands to the text location marked with a specific mark:

Linux Command Reference Linux Command Reference