On the command line, sometimes I want to tell a tool (e.g. grep) to look in all ...

@barubary@infosec.exchange

On the command line, sometimes I want to tell a tool (e.g. grep) to look in all directories except for one or two. This can be done with shell wildcards/globs.

All entries in the current directory:

grep -r 'honk honk' *

Subdirectories only:

grep -r 'honk honk' */

All subdirectories except for _build:

grep -r 'honk honk' !(_build)/

All subdirectories except for _build and cache:

grep -r 'honk honk' !(_build|cache)/

#bash