質問

Let's say I'd like to find something specific on a filesystem, but to omit certain directories in the search.

Rather than type locate string, I'd like to type locate string[omit anything which resides in specified directory].

So, for example, let's say I want to omit /usr/share from the listing.

How is this accomplished?

役に立ちましたか?

解決

locate string | grep -v ^/usr/share

Or, if you search with find, use -prune:

find / -name \*string\* \( -path '/usr/share' -prune -o -print \)
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top