1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| # | 管道命令:将前一个命令执行的结果作为内容交给下一个命令处理。可以形成多级管道操作。 # 命令1|命令2 可以将命令1的结果通过命令2作进一步的处理 [root@node1 ~]# ls 1.txt anaconda-ks.cfg hello lrzsz-0.12.20.tar.gz test test.file [root@node1 ~]# ls | grep ^t test test.file #相当于print 将内容输出console控制台 [root@node1 test]# echo 111 111 [root@node1 test]# echo "hello " hello ______________________________ # command > file 执行command然后将输出的内容存入file,file内已经存在的内容将被新内容覆盖替代。 # command >> file 执行command然后将输出的内容存入file,新内容追加在文件末尾。 [root@node1 test]# echo 111 > 4.txt [root@node1 test]# cat 4.txt 111 [root@node1 test]# echo 222 > 4.txt [root@node1 test]# cat 4.txt 222 [root@node1 test]# echo 333 >> 4.txt [root@node1 test]# cat 4.txt 222 333
|