문제

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