cat本身表示connection(拼接)
示例
显示文件内容(大文件更适合用head or tail)
$ cat file
将文件a和文件b的内容拼接在一块输出
$ cat file_a file_b
将标准输入与文件内容拼接在一起
$ echo "text through stdin" | cat - a
text through stdin
abc
$ echo "text through stdin" |cat a
abc
将文件a内容appen到旧文件b中
$ cat a >> b
注:> 为覆盖 >> 为追加
将文件a,b,c合并成新文件d
$ cat a b c >> d
显示文件内容并带行号
$cat -n file
1 efg
2 abc
3 abc
清空文件
$ cat /dev/null > file
其他参见
http://linux.chinaunix.net/techdoc/system/2007/11/16/972467.shtml