cat 1.txt > 2.txt
#将1.txt文件中的内容复制到2.txt文件中
cat 1.txt >> 2.txt
#将1.txt文件中的内容追加到2.txt文件中
[root@allen tmp]# ls [12].txt aaa.txt &> a.txt
#将正确和错误的信息输出到a.txt文件中,支持追加
[root@allen tmp]# cat a.txt
ls: 无法访问aaa.txt: 没有那个文件或目录
1.txt
2.txt
[root@allen tmp]# ls [12].txt aaa.txt > 1.txt 2>a.txt
#将正确和错误的结果区分开
[root@allen tmp]# cat 1.txt
1.txt
2.txt
[root@allen tmp]# cat a.txt
ls: 无法访问aaa.txt: 没有那个文件或目录
[root@allen tmp]# wc -l < 1.txt
2
#wc -l :查询一个文件的行数