Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use find command to ignore directory in linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to use the find command to ignore the directory in linux, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this to learn, I hope you can gain something.

Example 1: Search according to file attributes:

The code is as follows:

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/

Example 2: Search for:

The code is as follows:

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

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report