把 textfile1 的文檔內容加上行號后輸入 textfile2 這個文檔里:
~~~
cat -n textfile1 > textfile2
~~~
把 textfile1 和 textfile2 的文檔內容加上行號(空白行不加)之后將內容附加到 textfile3 文檔里:
~~~
cat -b textfile1 textfile2 >> textfile3
~~~
清空 /etc/test.txt 文檔內容:
~~~
cat /dev/null > /etc/test.txt
~~~