オプションで検索対象から除外できる

grepコマンドで検索する時に除外したいディレクトリがある場合は--exclude-dirで指定できる。

複数のディレクトリを指定する場合は、bashのブレース展開で--exclude-dirを複数回渡す。

grep -R word . --exclude-dir={bin,exe}
# 展開後: grep -R word . --exclude-dir=bin --exclude-dir=exe