Linux Recursive GREP search excluding directories example

This command will search for text inside files in a directory while excluding some directories you do not want to search in.

This is helpful when a search is going slow due to a directory that might contain thousands of files that you are not interested in searching through, such as an images or cache directory.

grep -r –exclude-dir=product_images –exclude-dir=cache –exclude-dir=.svn search term *

 

 

 

IFM Efector PN7004 Electronic Pressure Sensor Fast,
$80.0 IFM Efector PN7004 Electronic Pressure Sensor Fast,  picture
SMC D-M9B SOLID STATE SWITCH 888 - LOT OF 4
$15.0 SMC D-M9B SOLID STATE SWITCH 888 - LOT OF 4 picture
3D Printer X/Y/Z End Stop Limit Switch 2Pin Micro Control Module w/ Cable I8J4
$9.47 3D Printer X/Y/Z End Stop Limit Switch 2Pin Micro Control Module w/ Cable I8J4 picture
eWeLink Switch Universal Module 2CH /AC7-32V Switch U8P7
$18.96 eWeLink   Switch Universal Module 2CH /AC7-32V  Switch U8P7 picture
Electrical Industrial Equipment Switch Exit Push Button Emergency Button A8U8
$8.95 Electrical Industrial Equipment Switch Exit Push Button Emergency Button A8U8 picture

Powered by WordPress. Designed by WooThemes