xargs:把匹配得到的文件参数分批作为参数进行处理,和find命令一起使用。
exec: 将匹配到的文件作为参数一次进行处理
find:基于条件查找文件。
格式:find pathname -options [- print -exec -ok]
- -print find命令将匹配的文件输出到标准输出
- -exec find命令对匹配的文件执行该参数所给出的shell命令,命令的格式为:command { } /;
- -ok 给出用户提示,是否进行该操作
- option 选项的一些例子:-name -type -user -group (-mtime -n +n) -nogroup -nouser (-newer file1 ! file2)
例子:
find . -type -f -exec grep -l "$1" {} /;
find /home/alex /home/barbara -size +100 -atime -5 -ok rm {} /;