Speeding up grep Searches by Excluding Directories
The Lazy Sysadmin's grep
I work on a project on which I regularly want to grep the directory tree for a particular word but without including the cvs/ and doc/ directories. Happily, grep has an exclude-dir option to do just this:
grep -R --exclude-dir=cvs --exclude-dir=doc foo *It searches recursively for foo without looking in cvs/ or doc/, so the output isn't clogged up with unwanted results. Great.
The problem with this is that (in true sys admin style) I'm lazy and don't want to do all that typing. One solution to this is to set up an alias...
Read the rest of this excellent grep tip at Serverwatch.com
- 1Linux Top 3: Alpine Linux 3.4, deepin 15.2 and Linux Lite 3.0
- 2Linux 4.7 Set to Boost Live Patching, Security and Power Management
- 3Linux 4.6 Charred Weasel adds USB 3.1 Support
- 4Linux Top 3: OpenIndiana 2016.04, Ubuntu 16.04 and Debian's New Leader
- 5Linux Top 3: KaOS 2016.04, TurnKey 14.1 and pfSense 2.3