Ask HN: Setting to ignore /node_modules with find and grep

2 points by ereckers 9 years ago | 1 comment
Searching files in terminal and node_modules is making my life extremely uncomfortable.

Project directory looks like so:

   project/
   ├── index.html
   ├── node_modules
   ├── js/
   │   └── scripts.js
   └── style.css
I find myself using `find . | xargs grep "text string"` to search the project directory.

I want to ignore everything in node_modules all of the time.

I'm familiar with --prune and ignoring, etc.. but I want something like an alias in my .profile that ALWAYS ignores the contents of node_modules.

I've looked around, but I just don't know if I'm asking the question correctly.

Anyone have any solutions?

  • kspaans 9 years ago
    Tried `git grep`? It's a nearly full grep, and will ignore things that aren't tracked in the repo.