歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 對Linux下查看文本文件內容cat的認識

對Linux下查看文本文件內容cat的認識

日期:2017/2/28 17:48:37   编辑:Linux教程
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 結束錄入
Copyright © Linux教程網 All Rights Reserved