awk sed grep sort uniq less more xargs xargs: ls cp rm
案例1
[root@localhost ~]# touch /home/file{1..5}
[root@localhost ~]# vim files.txt
/home/file1
/home/file2
/home/file3
/home/file4
/home/file5
[root@localhost ~]# cat files.txt |ls -l //不加xargs传参,看输出结果
[root@localhost ~]# cat files.txt |rm -rvf //不加xargs传参,看输出结果
cont.
[root@localhost ~]# cat files.txt |xargs ls -l
-rw-r–r--. 1 root root 0 Mar 11 10:35 /home/file1
-rw-r–r--. 1 root root 0 Mar 11 10:35 /home/file2
-rw-r–r--. 1 root root 0 Mar 11 10:35 /home/file4
-rw-r–r--. 1 root root 0 Mar 11 10:35 /home/file5
[root@localhost ~]# cat files.txt |xargs rm -rvf
removed ‘/home/file1’
removed ‘/home/file2’
removed ‘/home/file4’
removed ‘/home/file5’
案例2
[root@localhost ~]# touch /home/file{1..5}
[root@localhost ~]# cat files.txt |xargs -I {} ls -l {}
-rw-r--r--. 1 root root 0 Mar 11 10:40 /home/file1
-rw-r--r--. 1 root root 0 Mar 11 10:40 /home/file2
-rw-r--r--. 1 root root 0 Mar 11 10:40 /home/file4
-rw-r--r--. 1 root root 0 Mar 11 10:40 /home/file5
[root@localhost ~]# cat files.txt |xargs -I {} cp -rvf {} /tmp
‘/home/file1’ -> ‘/tmp/file1’
‘/home/file2’ -> ‘/tmp/file2’
‘/home/file4’ -> ‘/tmp/file4’
‘/home/file5’ -> ‘/tmp/file5’
[root@localhost ~]# cat files.txt |xargs -I YOUNG cp -rvf YOUNG /var/tmp
‘/home/file1’ -> ‘/var/tmp/file1’
‘/home/file2’ -> ‘/var/tmp/file2’
‘/home/file4’ -> ‘/var/tmp/file4’
‘/home/file5’ -> ‘/var/tmp/file5’
案例3
[root@localhost ~]# find /etc -iname "*ifcfg*" |xargs -I {} cp -rf {} /tmp
find /root -name “*.txt” 以名字的方式从查找root下所有以.txt结尾的文件