1. 查看文件內容,並在每行前面加上行號
[root@rehat root]# cat -n test.txt
2. 查看文件內容,在不是空行的前面加上行號
[root@rehat root]# cat -b test.txt
3. 合並兩個文件的內容
[root@rehat root]# cat test1.txt test2.txt > test_new.txt
4. 全並兩具文件的內容,並追回到一個文件
[root@rehat root]# cat test1.txt test2.txt >> test_total.txt
5. 清空某個文件的內容
[root@rehat root]# cat /dev/null > test.txt
6. 創建一個新的文件
[root@rehat root]# cat > new.txt 按 CTRL + C 結束錄入