Frage

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?

War es hilfreich?

Lösung

locate string | grep -v ^/usr/share

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

find / -name \*string\* \( -path '/usr/share' -prune -o -print \)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top