在“/home /”目录中”中搜索文件扩展名为“.sh”的文件:
$find ~/-type f | grep "\.sh$"
搜索文件扩展名.sh
,.txt
或者.py
的所有文件
$find ~/-type f | grep -E "\.sh$|\.txt$|\.py$"
可以使用xargs对每个找到的文件执行操作,例如删除文件:
$find ~/-type f | grep -E "\.sh$|\.txt$|\.py$" | xargs -I {} rm {} \;
日期:2020-07-07 20:56:33 来源:oir作者:oir