linux查看和创建文件命令

cat /test/first.txt

 查看文件 

cat > second.txt
Hello 
everyone!

 >:表示导向

输入最后一行内容后,要将Enter键转行,否则最后一行不能显示

cat -b /test/first.txt

 为每一非空行加编号

cat first.txt second.txt third.txt

 同时显示多个文件内容 

cat first.txt second.txt third.txt > new.txt

 将多个文件合并到一个文件

more +3 new.txt

 "+行数":从该行起开始显示

more +/do new.txt

"+/字符串":从第一次出现该字符串开始显示

less new.txt

 按H出现在线使用说明,按Q离开

猜你喜欢

转载自hermosa-young.iteye.com/blog/1849445