创建x.sh文件,编辑

 

在/var/log/下查找log文件,复制文件到/home/omc/ftl且把结果保存到/home/omc/ftl/logs.txt文件中 

[root@localhost log]# find /var/log/*.log -type f | xargs -i cp {} /home/omc/ftl

[root@localhost log]# ll -ltr /home/omc/ftl

[root@localhost log]# find /var/log/*.log -type f > /home/omc/ftl/logs.txt

[root@localhost log]# ll /home/omc/ftl/logs.txt 

 

删除 /home/omc/ftl/下的log文件 

[root@localhost ftl]# ll *.log |xargs rm -rf {} 【错误】

[root@localhost ftl]# ls *.log |xargs rm -rf {} 【正确】 

posted on 2022-11-02 23:03  yi-sheng  阅读(71)  评论(0编辑  收藏  举报