红联Linux门户
Linux帮助

Linux中查看文本文件内容cat的了解

发布时间:2007-04-19 16:00:31来源:红联作者:Ptosassy
  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 结束录入
文章评论

共有 0 条评论