摘自:http://www.admin99.net/read.php/189.htm
使用方式:cat [-abeensttuv] [--help] [--version] filename
說明:把檔案串連線後傳到基本輸出(螢幕或加 > filename 到另乙個檔案)
引數:
-n 或 --number 由 1 開始對所有輸出的行數編號
-b 或 --number-nonblank 和 -n 相似,只不過對於空白行不編號
-s 或 --squeeze-blank 當遇到有連續兩行以上的空白行,就代換為一行的空白行
-v 或 --show-nonprinting
範例:
cat -n textfile1 > textfile2 把 textfile1 的檔案內容加上行號後輸入 textfile2 這個檔案裡
cat -b textfile1 textfile2 >> textfile3 把 textfile1 和 textfile2 的檔案內容加上行號(空白行不加)之後將內容附加到 textfile3 裡。
範例:
把 textfile1 的檔案內容加上行號後輸入 textfile2 這個檔案裡
cat -n textfile1 > textfile2
把 textfile1 和 textfile2 的檔案內容加上行號(空白行不加)之後將內容附加到 textfile3 裡。
cat -b textfile1 textfile2 >> textfile3
cat /dev/null > /etc/test.txt 此為清空/etc/test.txt檔案內容
cat 也可以用來製作 image file。例如要製作軟碟的 image file,將軟碟放好後打
cat /dev/fd0 > outfile
相反的,如果想把 image file 寫到軟碟,請打
cat img_file > /dev/fd0
注: 1. outfile 指輸出的 image 檔名。
2. img_file 指 image file。
3. 若從 image file 寫回 device 時,device 容量需與相當。
4. 通常用在製作開機磁片。
Linux作業系統常用命令
linux作業系統常用命令 檔案目錄操作命令 ls cd vi rm mv mkdir cp cat find less chown chmod ln 網路命令 hostname ping host telnet ifconfig ftp 使用者管理命令 useradd userdel passwd...
Linux作業系統常用命令
1 virtualbox虛擬機器工具 開源免費 2 ubuntu 12.04 lts 長期支援版本,穩定 3 vim 編輯器 4 gcc 編譯器 bcpl newb c unix minix linux linux管理硬碟的能力非常強,所以我們能看到的只有乙個分割槽 根目錄,所有的檔案都儲存在它下面...
Linux 作業系統常用命令
1.cd 切換目錄 2.打包 tar zcvf 歸檔檔案名.tar.gz 原始檔或目錄 3.解包 tar zxvf歸檔檔案名 c 目標目錄 4.檢視記憶體 free 5.檢視cpu lscpu 6.檢視動態程序 top 7.檢視靜態程序 ps ef 8.檢視特定程序 ps ef grep 8080 ...