top | item 11457376

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

2 points| ereckers | 10 years ago

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?

1 comment

order

kspaans|10 years ago

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