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 *

 

 

 

Johnson Controls Metasys MS-NAE5510-1 NAE 5510 Controller Version 7.0
$700.0 Johnson Controls Metasys MS-NAE5510-1 NAE 5510 Controller Version 7.0 picture
Johnson Controls Metasys NU-PWR101-0 Power Supply Module
$95.0 Johnson Controls Metasys NU-PWR101-0 Power Supply Module picture
Johnson Controls Metasys MS-NAE-4510-2
$1100.0 Johnson Controls Metasys MS-NAE-4510-2 picture
Johnson Controls Metasys AS-UNT1440-0
$300.0 Johnson Controls Metasys AS-UNT1440-0 picture
Johnson Controls Metasys AS-UNT1126-0
$450.0 Johnson Controls Metasys AS-UNT1126-0 picture

Powered by WordPress. Designed by WooThemes