一、重定向
FD:相当于快捷方式,超链接
">" : //相当于调用FD 向后面文件输入信息;
">>" 追加输入
输入重定向 <
二、 管道
eg:
[root@localhost alice]# cat /etc/passwd | head -3
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
tee管道
eg:
[root@localhost alice]# cat /etc/passwd |tee file88.txt | head -1
root:x:0:0:root:/root:/bin/bash
//输出文件 /etc/passwd 到file88.txt 并保存后 输出一行到显示器
[root@localhost alice]# cat /etc/passwd |grep "root" | head -1
root:x:0:0:root:/root:/bin/bash
[root@localhost alice]# cat /etc/passwd |grep "root"
root:x:0:0:root:/root:/bin/bash
operator:x:11:0:operator:/root:/sbin/nologin
[root@localhost alice]# cat /etc/passwd |grep "root" | head -1
root:x:0:0:root:/root:/bin/bash
[root@localhost alice]# cat /etc/passwd |grep "root" |tee file9.txt| head -1
root:x:0:0:root:/root:/bin/bash
参数传递Xargs
[root@localhost alice]# touch /home/file{1..5} //创建文件 1 2 3 4 5
[root@localhost alice]# ls /home/
alice file2 file4 jack test.txt user user02 volf
file1 file3 file5 nuinui1 u1 user01 user1 xulei
[root@localhost alice]# vim file1.txt //file1.txt 是文件
[root@localhost alice]# cat file1.txt
/home/file2
/home/fiel3
/home/file5 //内容
[root@localhost alice]# cat file1.txt | rm -rvf
cat: file1.txt: 没有那个文件或目录 //不能删除
[root@localhost alice]# cat file1.txt | xargs rm -rvf //加入xargs管道删除这些2 3 5文件
已删除"/home/file2"
已删除"/home/file5"
[root@localhost alice]# [root@localhost alice]# ls /home
alice file3 jack test.txt user user02 volf
file1 file4 nuinui1 u1 user01 user1 xulei
总结
| tee xarg s
后面 阿帕奇 Ngx 刀客特 云 集群 拍森