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

歡迎訪問 生活随笔!

生活随笔

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

linux

Linux命令集—— cat AND more

發(fā)布時間:2023/12/13 linux 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux命令集—— cat AND more 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1、cat

NAME

cat - concatenate files and print on the standard output

連接所有指定文件并將結(jié)果寫到標準輸出。【經(jīng)常用來顯示文件的內(nèi)容,類似DOS的TYPE 命令】

SYNOPSIS

cat [OPTION]... [FILE]...

cat [選項]... [文件]...

With no FILE, or when FILE is -, read standard input.

如果沒有指定文件,或者文件為"-",則從標準輸入讀取。

cat命令有兩項功能:

一是顯示文件的內(nèi)容,以此讀取由參數(shù)file指明的文件,將他們的內(nèi)容輸出到標準輸出上;

二是連接兩個或多個文件,如“cat f1 f2 > f3”將把文件f1和f2的內(nèi)容合并起來,然后通過輸出重定向符“>”,將它們放入文件f3中。

示例

cat f - g ?先輸出f 的內(nèi)容,然后輸出標準輸入的內(nèi)容,最后輸出g 的內(nèi)容。

cat ? ? ? ?將標準輸入的內(nèi)容復制到標準輸出。

【設(shè)m1和m2時當前目錄下的兩個文件】

$ cat m1 (在屏幕上顯示文件m1的內(nèi)容)

$ cat m1 m2 (同時顯示文件m1和m2的內(nèi)容)

常用選項

? ? ? ?-A, --show-all
? ? ? ? ? ? ? equivalent to -vET

? ? ? 等價于 -vET

? ? ? ?-b, --number-nonblank
? ? ? ? ? ? ? number nonempty output lines, overrides -n

? ? ? 從1開始對所有非空輸出行編號,覆蓋 -n

? ? ? ?-e ? ? equivalent to -vE?等價于 -vE

? ? ? ?-E, --show-ends
? ? ? ? ? ? ? display $ at end of each line

? ? ? 在每行結(jié)束處顯示?$

? ? ? ?-n, --number
? ? ? ? ? ? ? number all output lines

? ? ??從1開始對所有輸出行編號

? ? ? ?-s, --squeeze-blank
? ? ? ? ? ? ? suppress repeated empty output lines

? ? ? 將多個相鄰的空行合并成一個空行

? ? ? ?-t ? ? equivalent to -vT?與-vT 等價

? ? ? ?-T, --show-tabs
? ? ? ? ? ? ? display TAB characters as ^I

? ? ??將Tab顯示為^I

? ? ? ?-u ? ? (ignored)?(被忽略)

? ? ? ?-v, --show-nonprinting
? ? ? ? ? ? ? use ^ and M- notation, except for LFD and TAB

? ? ? 除了LFD和 TAB 之外使用^ 和M- 引用

? ? ? ?--help display this help and exit 顯示此幫助信息并退出

? ? ? ?--version output version information and exit 顯示版本信息并退出

注意

當文件較大時,文本在屏幕上迅速閃過(滾屏),用戶往往看不清所顯示的內(nèi)容,因此一般用more等命令分屏顯示。為了控制滾屏,課用Ctrl+S鍵,停止?jié)L屏;Ctrl+Q鍵,回復滾屏;Ctrl+C鍵(中斷),可以終止命令的執(zhí)行,并且返回shell提示符狀態(tài)。

tac 是將 cat 反寫過來,所以它的功能就跟 cat 相反,cat 是由第一行到最后一行連續(xù)顯示在屏幕上,而 tac 則是由最后一行到第一行反向在屏幕上顯示出來

2、more

NAME

more - file perusal filter for crt viewing?適合屏幕查看的文件閱讀輸出工具。

SYNOPSIS

more [options] file...??more [選項] <文件>...

常用選項

? ? ? -d ? ? Prompt with "[Press space to continue, 'q' to ?quit.]", ?and ?display ?"[Press ?'h' ?for
? ? ? ? ? ? ? instructions.]" instead of ringing the bell when an illegal key is pressed.

? ? ? 在每屏的底部顯示以下更友好的提示信息:

? ? ? --更多--(21%)[Press space to continue, 'q' to ?quit.]

? ?? 當用戶按鍵有錯誤時,則顯示[Press ?'h' ?for instructions.]信息,而不是簡單報警。

? ? ? ?-l ? ? Do not pause after any line containing a ^L (form feed). 屏蔽換頁 [^L] (form feed)后的暫停

? ? ? ?-f ? ? Count logical lines, rather than screen lines (i.e., long lines are not folded).

? ? ?? 計算邏輯行數(shù),而不是屏幕行數(shù)(即,不折疊長行)。

? ? ? ?-p ? ? Do ?not scroll. ?Instead, clear the whole screen and then display the text. ?Notice that
? ? ? ? ? ? ? this option is switched on automatically if the executable is named page.

? ? ? ? ? ? ? 不滾動,顯示文本并清理行末。注意這個頁面上的選項是自動切換的。

? ? ? ?-c ? ? Do not scroll. ?Instead, paint each screen from the top, clearing the remainder of ?each
? ? ? ? ? ? ? line as it is displayed.

? ? ??不滾動,清除屏幕并顯示文本,從頂部繪制每個屏幕,在顯示時清除每行的剩余部分。

? ? ? ?-s ? ? Squeeze multiple blank lines into one. 將文件中連續(xù)的空白行壓縮成一個空白行顯示

? ? ? ?-u ? ? Suppress underlining.?把文件內(nèi)容中的下畫線去掉

? ? ?? -number
? ? ? ? ? ? ? The screen size to use, in number of lines.

? ? ? ? ? ? ? 指定一個整數(shù)num,表示一屏顯示多少行

? ? ? ?+number
? ? ? ? ? ? ? Start displaying each file at line number.

? ? ?? 從指定行開始顯示文件

? ? ? ?+/string
? ? ? ? ? ? ? The string to be searched in each file before starting to display it.?

? ? ? 從匹配搜索字符串的位置開始顯示文件

說明

more命令是一個基于vi編輯器的文本過濾器,以全屏幕形式顯示文件內(nèi)容。

more命令一次顯示一瓶文本(file文件),滿屏后停下來,并且在屏幕底部出現(xiàn)一個提示信息,給出至今已顯示的該文件的百分比“--更多--(xx%)”。

可以用下列不同的方法對提示作出回答:

  • 按Space鍵,顯示文本的下一屏內(nèi)容。
  • 按Enter鍵,只顯示文本的下一行內(nèi)容。
  • 按“/”鍵,接著輸入一個模式,可以在文本中尋找下一個相匹配的模式。
  • 按h鍵或?鍵,顯示幫助屏,其中有相關(guān)的幫助信息。
  • 按B鍵或^B,顯示上一屏內(nèi)容。
  • 按Q鍵,退出more命令。

示例

1、顯示文件mfile的內(nèi)容,在顯示之前先清屏,并在屏幕下方顯示完整的百分比。

$ more -dc mfile

2、顯示文件mfile的內(nèi)容,每10行顯示一次,而且在顯示之前先清屏。

$ more -c -10 mfile

總結(jié)

以上是生活随笔為你收集整理的Linux命令集—— cat AND more的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。