grep recursive ignore directory code example Example: grep exclude directory grep -rli --exclude-dir={dir1,dir2,dir3} keyword /path/to/search