45fan.com - 路饭网

搜索: 您的位置主页 > 电脑频道 > 电脑教程 > 阅读资讯:linux find如何忽略目录查找?

linux find如何忽略目录查找?

2015-05-27 12:40:54 来源:www.45fan.com 【

linux find如何忽略目录查找?

以下来看看find命令忽略目录查找的用法吧。

例1,根据文件属性查找:

 

复制代码 代码如下:

find . -type f -name "*config*" ! -path "./tmp/*" ! -path "./scripts/*" ! -path "./node_modules/*"
Explanation:
find . - Start find from current working directory (recursively by default)
-type f - Specify to find that you only want files in the results
-name "*_peaks.bed" - Look for files with the name ending in _peaks.bed
! -path "./tmp/*" - Exclude all results whose path starts with ./tmp/
! -path "./scripts/*" - Also exclude all results whose path starts with ./scripts/

 

例2,根据文件内容查找:

 

复制代码 代码如下:

grep -n -r --exclude-dir='node_modules' --exclude-dir='logs' --exclude="nohup.out" 192 *


 


本文地址:http://www.45fan.com/dnjc/11290.html
Tags: linux find
编辑:路饭网
关于我们 | 联系我们 | 友情链接 | 网站地图 | Sitemap | App | 返回顶部