| 竖线符号 (管道符号)

 

1. 表示管道符号,管道前面的命令交给后面执行

 

 

2. 经常配合xargs命令使用

 

find /opt -type f -name "*.txt" -delete

find /opt -type f -name "*.txt" -exec rm -rf {} \;

find /opt -type f -name "*.txt" | xargs rm -rf



查找指定数据进行复制

 

find /opt -type f -name "*.txt" | xargs cp /opt/backup

ecs

 

#添加 -i {} 参数 让前面的结果 放到{} 里面

#将找到的信息放到cp 和最终目录中间

find /opt -type f -name "*.txt" | xargs -i cp {} /opt/backup/

 

ecs

#-t target

#利用cp指明数据最终保存目录信息

find /opt -type f -name "*.txt" | xargs cp -t /opt/backup

 

ecs

exec方法

find /opt -type f -name "*.txt" -exec cp -a {} /opt/backup \;

 

ecs