Linux 指令篇:檔案目錄管理--cat
名稱:cat
使用權(quán)限:所有使用者
使用方式:cat [參數(shù)] fileName
說明:
1.顯示文本文件的內(nèi)容
范例: cat textfile
2.把檔案串連接后傳到基本輸出(螢?zāi)换蚣?> fileName 到另一個檔案)
范例:
cat -n textfile1 > textfile2 把 textfile1 的檔案內(nèi)容加上行號后輸入 textfile2 這個檔案里
cat -b textfile1 textfile2 > textfile3 把 textfile1 和 textfile2 的檔案內(nèi)容加上行號(空白行不 加)之后將內(nèi)容附加到 textfile3 里。
3.清空檔案內(nèi)容
范例:cat /dev/null > /etc/test.txt 此為清空/etc/test.txt檔案內(nèi)容
參數(shù):
-n 或 --number 由 1 開始對所有輸出的行數(shù)編號
-b 或 --number-nonblank 和 -n 相似,只不過對于空白行不編號
-s 或 --squeeze-blank 當(dāng)遇到有連續(xù)兩行以上的空白行,就代換為一行的空白行
-v 或 --show-nonprinting
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 容量需與相當(dāng)。
4. 通常用在制作開機(jī)磁片。
posted on 2007-11-08 11:31
小言身寸 閱讀(174)
評論(0) 編輯 收藏