国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Linux 終端命令之文件瀏覽(1) cat

這篇具有很好參考價值的文章主要介紹了Linux 終端命令之文件瀏覽(1) cat。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

Linux 終端命令之文件瀏覽(1) cat,Linux,linux,shell

Linux 文件瀏覽命令

cat, more, less, head, tail,此五個文件瀏覽類的命令皆為外部命令。

hann@HannYang:~$ which cat
/usr/bin/cat
hann@HannYang:~$ which more
/usr/bin/more
hann@HannYang:~$ which less
/usr/bin/less
hann@HannYang:~$ which head
/usr/bin/head
hann@HannYang:~$ which tail
/usr/bin/tail

(1) cats

英文幫助

NAME
? ? ? ?cat - concatenate files and print on the standard output

SYNOPSIS
? ? ? ?cat [OPTION]... [FILE]...

DESCRIPTION
? ? ? ?Concatenate FILE(s) to standard output.

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

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

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

? ? ? ?-e ? ? equivalent to -vE

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

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

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

? ? ? ?-t ? ? equivalent to -vT

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

? ? ? ?-u ? ? (ignored)

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

? ? ? ?--help display this help and exit

? ? ? ?--version
? ? ? ? ? ? ? output version information and exit

EXAMPLES
? ? ? ?cat f - g
? ? ? ? ? ? ? Output f's contents, then standard input, then g's contents.

? ? ? ?cat ? ?Copy standard input to standard output.

AUTHOR
? ? ? ?Written by Torbjorn Granlund and Richard M. Stallman.

REPORTING BUGS
? ? ? ?GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
? ? ? ?Report cat translation bugs to <https://translationproject.org/team/>

COPYRIGHT
? ? ? ?Copyright ? ? ? 2018 ? Free ? Software ? Foundation, ?Inc. ? License ?GPLv3+: ?GNU ?GPL ?version ?3 ?or ?later
? ? ? ?<https://gnu.org/licenses/gpl.html>.
? ? ? ?This is free software: you are free to change and redistribute it. ?There is NO WARRANTY, to the ?extent ?per‐mitted by law.


中文注解?

cat? 連接文件并在標(biāo)準(zhǔn)輸出上打印

可以用它來顯示文件內(nèi)容,創(chuàng)建文件,還可以用它來顯示控制字符。

cat命令的一般形式為:

cat [options] filename1 ... filename2 ...

幫助
hann@HannYang:~$ cat --help
Usage: cat [OPTION]... [FILE]...
Concatenate FILE(s) to standard output.

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

  -A, --show-all           equivalent to -vET
  -b, --number-nonblank    number nonempty output lines, overrides -n
  -e                       equivalent to -vE
  -E, --show-ends          display $ at end of each line
  -n, --number             number all output lines
  -s, --squeeze-blank      suppress repeated empty output lines
  -t                       equivalent to -vT
  -T, --show-tabs          display TAB characters as ^I
  -u                       (ignored)
  -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB
      --help     display this help and exit
      --version  output version information and exit

Examples:
  cat f - g  Output f's contents, then standard input, then g's contents.
  cat        Copy standard input to standard output.

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report cat translation bugs to <https://translationproject.org/team/>
Full documentation at: <https://www.gnu.org/software/coreutils/cat>
or available locally via: info '(coreutils) cat invocation'
版本
hann@HannYang:~$ cat --version
cat (GNU coreutils) 8.30
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund and Richard M. Stallman.
注釋

1. 如果希望顯示名為myfile的文件,可以用:

$ cat myfile?

2. 在使用cat命令時要注意,它不會在文件分頁符處停下來;它會一下顯示完整個文件。如果希望每次顯示一頁,可以使用more命令或把cat命令的輸出通過管道傳遞到另外一個具有分頁功能的命令中,如:

$ cat myfile | more

上面這個寫法與 $ more myfile 等效

3. 參數(shù) -n 或 -number 可以自動在每一行的顯示內(nèi)容前標(biāo)注上行號,如:

hann@HannYang:~$ cat -n cmd1.txt
     1  alias - Define or display aliases.
     2  alias: alias [-p] [name[=value] ... ]
     3  bg - Move jobs to the background.
     4  bg: bg [job_spec ...]
     5  bind - Set Readline key bindings and variables.
     6  ......

4. 如果希望顯示myfile1、myfile2、myfile3這三個文件,可以用:

$ cat myfile1 myfile2 myfile3

5. 如果希望創(chuàng)建一個名為bigfile的文件,該文件包含上述三個文件的內(nèi)容,可以把上面命令的輸出重定向到新文件中,這就是cat連接文件的功能

$ cat myfile1 myfile2 myfile3 > bigfile

6. 有一點要提醒的是,如果在敲入了cat以后就直接按回車,該命令會等你輸入字符。也是說幫助中說的“With no FILE, or when FILE is -, read standard input.”,沒有文件時則從標(biāo)準(zhǔn)輸入(默認設(shè)備就是鍵盤)中讀取內(nèi)容。如果你本來就是要輸入一些字符,那么它除了會在你輸入時在屏幕上顯示以外,還會再回顯這些內(nèi)容;最后按<Ctrl-d>結(jié)束輸入即可。

hann@HannYang:~$ cat
123456789
123456789
abcdefg
abcdefg

7. 如果希望創(chuàng)建一個新文件,并向其中輸入一些內(nèi)容,只需使用cat命令把標(biāo)準(zhǔn)輸出重定向到該文件中,這時cat命令的輸入是標(biāo)準(zhǔn)輸入—鍵盤,你輸入一些文字,輸入完畢后按<Ctrl-d>結(jié)束輸入。這就是一個非常簡單的文字編輯器!

hann@HannYang:~$ cat > myfile
123456789
abcdefg
hann@HannYang:~$ cat myfile
123456789
abcdefg

上面這個功能,與Dos命令中的copy con file類似:

C:\Users\boyso>copy con myfile
123456
abcdef
^Z
已復(fù)制 ? ? ? ? 1 個文件。

C:\Users\boyso>type myfile
123456
abcdef

Dos系統(tǒng)是用<Ctrl-z>退出輸出的。

8.? 連接多個文件時,還能用鍵盤輸入一些內(nèi)容。即是前面第6點中提到的“or when FILE is -” ,也就當(dāng)文件參數(shù)有“-”減號時,就從鍵盤輸入內(nèi)容直到按<Ctrl-d>結(jié)束輸入。

例如以下操作,連接文件aa,bb成cc,并且兩個文件間用"==========="隔開:

hann@HannYang:~$ cat aa
abcd
efg
hann@HannYang:~$ cat bb
123456
7890
hann@HannYang:~$ cat aa - bb > cc
===========
hann@HannYang:~$ cat cc
abcd
efg
===========
123456
7890

文章來源地址http://www.zghlxwxcb.cn/news/detail-644606.html

到了這里,關(guān)于Linux 終端命令之文件瀏覽(1) cat的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 【Shell 命令集合 系統(tǒng)管理 】Linux 終端復(fù)用工具 screen命令 使用指南

    【Shell 命令集合 系統(tǒng)管理 】Linux 終端復(fù)用工具 screen命令 使用指南

    Shell 命令專欄:Linux Shell 命令全解析 screen命令是一個在Linux操作系統(tǒng)中使用的終端復(fù)用工具。它允許用戶在一個終端窗口中同時運行多個終端會話,并且可以在這些會話之間自由切換。 screen命令的主要作用是提供一個“會話管理器”,可以在一個終端窗口中創(chuàng)建多個虛擬終端

    2024年02月05日
    瀏覽(133)
  • R studio Linux終端命令找不到了 shell terminal
  • Linux命令(23)之cat
Linux命令之cat

    Linux命令(23)之cat Linux命令之cat

    linux命令cat用于把文件內(nèi)容顯示在標(biāo)準(zhǔn)輸出設(shè)備(即:顯示器)上,也可以(單個/幾個)文件內(nèi)容追加別的文件當(dāng)中去。 cat [參數(shù)] [文件名稱] cat命令常用參數(shù) 參數(shù) 說明 -b 對所有非空輸出進行編號,即空行不進行編號 -s 當(dāng)遇到有連續(xù)兩行以上的空白行時,“合并”為一行空白

    2024年02月06日
    瀏覽(23)
  • Linux 終端命令之文件目錄操作,對比Dos相關(guān)命令

    Linux 終端命令之文件目錄操作,對比Dos相關(guān)命令

    目錄 前言 基礎(chǔ)命令(文件目錄相關(guān)的) cd命令 【英文幫助】 【對應(yīng)Dos命令】 pwd命令 【英文幫助】 【對應(yīng)Dos命令】 ls命令 【英文幫助】 【對應(yīng)Dos命令】 tree命令 【英文幫助】 【對應(yīng)Dos命令】 mkdir命令 【英文幫助】 【對應(yīng)Dos命令】 rmdir/rm命令 【英文幫助】 【對應(yīng)Dos命令

    2024年02月11日
    瀏覽(27)
  • 【Linux | Shell命令】bash shell 進程、磁盤、文件處理命令

    【Linux | Shell命令】bash shell 進程、磁盤、文件處理命令

    上篇文章 bash shell 基礎(chǔ)命令 中,介紹了一些與目錄、文件相關(guān)的 shell 命令,本文繼續(xù)介紹其他與進程、磁盤、排序、歸檔相關(guān)的命令,讀者可以在自己的Linux系統(tǒng)下,實操這些命令,進而收悉并掌握這些命令。本文是一篇學(xué)習(xí)筆記,很多內(nèi)容是參考了《Linux命令行與shell腳本

    2024年02月11日
    瀏覽(99)
  • Shell命令操作Linux文件系統(tǒng)

    Shell命令操作Linux文件系統(tǒng)

    ??Linux文件系統(tǒng)是計算機操作系統(tǒng)中的一個關(guān)鍵組成部分,它用于管理和組織計算機上的數(shù)據(jù)和信息。先到根目錄,然后打印當(dāng)前目錄下文件: ??有一些比較常用的文件夾介紹如下: ?? /bin ——包含常見Linux 用戶命令,比如 ls、sort、date和l chmod。 ?? /home ——包含分

    2024年02月09日
    瀏覽(25)
  • 【Shell 命令集合 文件管理】Linux 拆分文件 split命令使用教程

    【Shell 命令集合 文件管理】Linux 拆分文件 split命令使用教程

    Shell 命令專欄:Linux Shell 命令全解析 split命令是Linux系統(tǒng)中的一個用于拆分文件的命令。它可以將一個大文件拆分成多個小文件,以便于傳輸、存儲或處理。下面是split命令的詳細描述: -b 大小 :指定每個輸出文件的大小。大小可以使用后綴(如K、M、G)來表示,默認單位是

    2024年02月10日
    瀏覽(39)
  • 【Shell 命令集合 文件管理】Linux 移動文件命令 mv命令使用指南

    【Shell 命令集合 文件管理】Linux 移動文件命令 mv命令使用指南

    Shell 命令專欄:Linux Shell 命令全解析 mv 命令是Linux中用于移動或重命名文件和目錄的命令。它的基本語法如下: mv 命令可以有以下幾種用法: 移動文件或目錄:將源文件或目錄移動到目標(biāo)位置。如果目標(biāo)位置是一個目錄,則將源文件或目錄移動到該目錄下。如果目標(biāo)位置是

    2024年02月09日
    瀏覽(99)
  • 【Shell 命令集合 文件管理】Linux 補丁文件應(yīng)用命令 patch命令使用指南

    【Shell 命令集合 文件管理】Linux 補丁文件應(yīng)用命令 patch命令使用指南

    Shell 命令專欄:Linux Shell 命令全解析 在Linux中, patch 命令用于將補丁文件應(yīng)用到源代碼文件中,從而實現(xiàn)對源代碼的修改。 patch 命令的詳細描述如下: patch 命令用于將補丁文件應(yīng)用到源代碼文件中,以實現(xiàn)對源代碼的修改。補丁文件通常是由開發(fā)者或者社區(qū)提供的,用于修

    2024年02月09日
    瀏覽(200)
  • Linux cat 命令

    cat(英文全拼:concatenate)命令用于連接文件并打印到標(biāo)準(zhǔn)輸出設(shè)備上。 1、使用權(quán)限 ????????所有使用者 2、語法格式 3、參數(shù)說明: ????????-n 或 --number :由 1 開始對所有輸出的行數(shù)編號。 ????????-b 或 --number-nonblank :和 -n 相似,只不過對于空白行不編號。 ?

    2024年02月04日
    瀏覽(41)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包