linux find命令忽略目錄的查找方法
發(fā)布日期:2022-03-11 16:23 | 文章來源:CSDN
在linux操作系統(tǒng)中,find命令非常強大,在文件與目錄的查找方面可謂無所不至其極,如果能結(jié)合xargs命令使得,更是強大無比。
以下來看看find命令忽略目錄查找的用法吧。
例1,根據(jù)文件屬性查找:
復(fù)制代碼
代碼如下: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,根據(jù)文件內(nèi)容查找:
復(fù)制代碼
代碼如下:grep -n -r --exclude-dir='node_modules' --exclude-dir='logs' --exclude="nohup.out" 192 *
當(dāng)前大家也可以參考這篇文章:linux find命令忽略某個或多個子目錄的實例
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。
相關(guān)文章