Linux常用基本命令(less)

LESS:跟more命令的功能类似,都是用于分页显示内容,但是他的性能比more更高,功能比more更丰富,他读取文件是按需加载

格式:

less [option] [file]

-N : 显示每行的行号 类似cat命令的-n

-s: 将连续的空行显示为一行

交互子命令:

b: 向前翻一页

空格键:向后翻一页

u:向前翻半屏

d:向后翻半屏

y:向上滚动一行

回车键:向下滚动一行

/字符串 向下搜索字符串

?字符串 向上搜索字符串

n 向后查找下一个匹配的文本

N 向前查找前一个匹配的文本 

G:移动到最后一行 

g:移动到第一行

h:显示帮助页面

q:退出less命令

ghostwu@dev:~/linux/more$ ls /etc | less -N

在交互模式下,用h显示帮助页面,可以查看less命令详细用法

1 
      2                    SUMMARY OF LESS COMMANDS
      3 
      4       Commands marked with * may be preceded by a number, N.
      5       Notes in parentheses indicate the behavior if N is given.
      6       A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-      6 K.
      7 
      8   h  H                 Display this help.
      9   q  :q  Q  :Q  ZZ     Exit.
     10  -----------------------------------------------------------------------     10 ----
     11 
     12                            MOVING
     13 
     14   e  ^E  j  ^N  CR  *  Forward  one line   (or N lines).
     15   y  ^Y  k  ^K  ^P  *  Backward one line   (or N lines).
     16   f  ^F  ^V  SPACE  *  Forward  one window (or N lines).
     17   b  ^B  ESC-v      *  Backward one window (or N lines).
     18   z                 *  Forward  one window (and set window to N).
     19   w                 *  Backward one window (and set window to N)
原文地址:https://www.cnblogs.com/ghostwu/p/9054248.html