1. 命令解析
命令用途:
與cat全部顯示文件內(nèi)容不同,more用于分頁顯示文件內(nèi)容,通過使用空格或者CTRL+F翻頁,或使用CTRL+B后退一頁;
命令格式:
more [options] file...
命令參數(shù):
-NUM specify the number of lines per screenful
+NUM display file beginning from line number NUM
+/STRING display file beginning from search string match
常用操作命令:
Enter 向下n行,需要定義。默認(rèn)為1行
Ctrl+F 向下滾動(dòng)一屏
空格鍵 向下滾動(dòng)一屏
Ctrl+B 返回上一屏
= 輸出當(dāng)前行的行號(hào)
:f 輸出文件名和當(dāng)前行的行號(hào)
V 調(diào)用vi編輯器
!命令 調(diào)用Shell预烙,并執(zhí)行命令
q 退出more
2. 示例
2.1 從第3行開始分頁顯示文件內(nèi)容
[root@test fs]# more +3 Kconfig
2.2 從文件中查找第一個(gè)出現(xiàn)"fs"字符串的行,并從該行前兩行開始顯示
root@test fs]# more +/fs Kconfig
...skipping
if BLOCK
source "fs/ext2/Kconfig"
source "fs/ext3/Kconfig"
source "fs/ext4/Kconfig"
2.3 設(shè)定每屏顯示行數(shù)
[root@test fs]# more -5 Kconfig
#
# File system configuration
#
menu "File systems"
--More--(0%)
2.4 使用more過濾ls的輸出
[root@test fs]# ll |more +/sysfs -2
...skipping
drwxr-xr-x. 2 root root 4096 Jul 9 2014 sysfs
drwxr-xr-x. 2 root root 4096 Jul 9 2014 sysv
drwxr-xr-x. 2 root root 4096 Jul 9 2014 ubifs