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 *

 

 

 

TORR TOYS EUR Glass Hopper Crystal PUR 300 Glossy - for Eureka Zenith/Olympus
$220.0 TORR TOYS EUR Glass Hopper Crystal PUR 300 Glossy - for Eureka Zenith/Olympus picture
2Pcs Luxury Crystals Metal Ballpoint Pen Roller Ball Pen Office Stationery Plsei
$3.78 2Pcs Luxury Crystals Metal Ballpoint Pen Roller Ball Pen Office Stationery Plsei picture
2Pcs Luxury Crystals Metal Ballpoint Pen Roller Ball Pen Office Stationery Plsei
$3.78 2Pcs Luxury Crystals Metal Ballpoint Pen Roller Ball Pen Office Stationery Plsei picture
2Pcs Luxury Crystals Metal Ballpoint Pen Roller Ball Pen Office Stationery Plsei
$3.78 2Pcs Luxury Crystals Metal Ballpoint Pen Roller Ball Pen Office Stationery Plsei picture
2Pcs Luxury Crystals Metal Ballpoint Pen Roller Ball Pen Office Stationery Plsei
$3.78 2Pcs Luxury Crystals Metal Ballpoint Pen Roller Ball Pen Office Stationery Plsei picture

Powered by WordPress. Designed by WooThemes