进程管道 Piping
简介:管道命令可以将多条命令组合起来,一次性完成复杂的处理任务。
语法:command1 | command2 |command3 |...
- 指令1的标准输出
- 作为指令2的标准输入
[root@localhost ~]# cat /etc/passwd | tail -3
[root@localhost ~]# ps aux | grep 'sshd'
tee管道
三通管道,即交给另一个程序处理。又保存一份副本
[root@localhost ~]# cat /etc/passwd |tee 898.txt | tail -1
qianfeng:x:1001:1001::/home/qianfeng:/bin/bash
[root@localhost ~]# cat 888.txt
- 888.txt文本中的内容是命令1 (cat)处理的结果
参数传递 Xargs
cp rm一些特殊命令无法输出过程
[root@localhost ~]# cat files.txt |xargs rm -rvf
removed ‘/home/file1’
- 通过|xargs成功连接rm命令