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 {} /;