文件及訊息管理指令

cat

Examples :

cat file1 file2 (results will display on screen)

cat file1 file2 > files3

cat file1 file2 >> file3

 

 

more

每次印出一個終端機畫面,按 space 鍵看下一畫面,按 Enter 鍵多看下一行,打 q 退出。

Example :

more my_textfile.txt

 

grep

Example :

grep keyword filename

grep keyword filename

grep "more than one keywords" filename

多重目錄之 grep

grep keyword ./*/*.txt

 

| (pipe)

 

> (direct)

 

>> (append)

 

tail -f my_file.txt

 

補充(取自 網路農夫 http://libai.math.ncu.edu.tw/bcc16/5/csh/no3-2.html)

符號

說 明

>

將 stdout 重導向到檔案(command > file)

>>

將 stdout 資料串加到檔案內容之後(command >> file)

>&

stdout 及 stderr 重導向到檔案(command >& file)

>>&

將 steout 及 stderr 資料串加到檔案內容之後(command >>& file)

>!

將 stdout 重導向到檔案,有設定 $noclobber 時,可重寫檔案。

>>!

將 stdout 資料串加到檔案內容之後,有設定 $noclobber 時,可重寫檔案。

>&!

stdout 及 stderr 重導向到檔案,有設定 $noclobber 時,可重寫檔案。

>>&!

將 steout 及 stderr 資料串加到檔案內容之後,有設定 $noclobber 時,可重寫檔案。