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)