日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux more 高亮_linux more命令的使用

發布時間:2023/12/20 linux 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux more 高亮_linux more命令的使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

more -s testfile 逐頁顯示 testfile 之檔案內容,如有連續兩行以上空白行則以一行空白行顯示。那么你知道linux more命令怎么使用么?接下來是小編為大家收集的linux more命令的使用,歡迎大家閱讀:

linux more命令的使用

1.命令格式:

more [-dlfpcsu ] [-num ] [+/ pattern] [+ linenum] [file ... ]

2.命令功能:

more命令和cat的功能一樣都是查看文件里的內容,但有所不同的是more可以按頁來查看文件的內容,還支持直接跳轉行等功能。

3.命令參數:

+n 從笫n行開始顯示

-n 定義屏幕大小為n行

+/pattern 在每個檔案顯示前搜尋該字串(pattern),然后從該字串前兩行之后開始顯示

-c 從頂部清屏,然后顯示

-d 提示“Press space to continue,’q’ to quit(按空格鍵繼續,按q鍵退出)”,禁用響鈴功能

-l 忽略Ctrl+l(換頁)字符

-p 通過清除窗口而不是滾屏來對文件進行換頁,與-c選項相似

-s 把連續的多個空行顯示為一行

-u 把文件內容中的下畫線去掉

4.常用操作命令:

Enter 向下n行,需要定義。默認為1行

Ctrl+F 向下滾動一屏

空格鍵 向下滾動一屏

Ctrl+B 返回上一屏

= 輸出當前行的行號

:f 輸出文件名和當前行的行號

V 調用vi編輯器

!命令 調用Shell,并執行命令

q 退出more

5.命令實例:

實例1:顯示文件中從第3行起的內容

命令:

more +3 log2012.log

輸出:

[root@localhost test]# cat log2012.log

2012-01

2012-02

2012-03

2012-04-day1

2012-04-day2

2012-04-day3

======[root@localhost test]# more +3 log2012.log

2012-03

2012-04-day1

2012-04-day2

2012-04-day3

======[root@localhost test]#

實例2:從文件中查找第一個出現"day3"字符串的行,并從該處前兩行開始顯示輸出

命令:

more +/day3 log2012.log

輸出:

[root@localhost test]# more +/day3 log2012.log

...skipping

2012-04-day1

2012-04-day2

2012-04-day3

2012-05

2012-05-day1

======[root@localhost test]#

實例3:設定每屏顯示行數

命令:

more -5 log2012.log

輸出:

[root@localhost test]# more -5 log2012.log

2012-01

2012-02

2012-03

2012-04-day1

2012-04-day2

說明:

如下所示,最下面顯示了該屏展示的內容占文件總行數的比例,按 Ctrl+F 或者 空格鍵 將會顯示下一屏5條內容,百分比也會跟著變化。

實例4:列一個目錄下的文件,由于內容太多,我們應該學會用more來分頁顯示。這得和管道 | 結合起來

命令:

ls -l | more -5

輸出:

[root@localhost test]# ls -l | more -5

總計 36

-rw-r--r-- 1 root root 308 11-01 16:49 log2012.log

-rw-r--r-- 1 root root 33 10-28 16:54 log2013.log

-rw-r--r-- 1 root root 127 10-28 16:51 log2014.log

lrwxrwxrwx 1 root root 7 10-28 15:18 log_link.log -> log.log

-rw-r--r-- 1 root root 25 10-28 17:02 log.log

-rw-r--r-- 1 root root 37 10-28 17:07 log.txt

drwxr-xr-x 6 root root 4096 10-27 01:58 scf

drwxrwxrwx 2 root root 4096 10-28 14:47 test3

drwxrwxrwx 2 root root 4096 10-28 14:47 test4

說明:

每頁顯示5個文件信息,按 Ctrl+F 或者 空格鍵 將會顯示下5條文件信息。

看了“linux more命令的使用”還想看:

總結

以上是生活随笔為你收集整理的linux more 高亮_linux more命令的使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。