Search for content in files in linux (recursively and case-independent)

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You would like to find the files that contain some specific text, and would like to do it recursively (ie in a project folder), using something simpler than the find command.

Solution

You can use the following in your current top folder to search recursively, case-independent and by displaying the file number that the searched text appears, with the following:

Search for specific string in files/directories with line number in linux

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You want to search in a directory or some files for a specific string and you also want to know the number in the file that the text is found.

Solution

Use grep with the -n for the line number and the -r for directory search as in the following: