Search for text in files on Linux

Searching for a certain text in mulitple files? Just run:

grep -lir "word" *

And you’re all set. It will return you the name of the files containing “word” in the current folders and subfolders.

~/projects/xap $ grep -lir "header" *

If you then need the lines that contain the search term, just omit the ‘l’:

~/projects/xap $ grep -ir "header" *
hub.c:  // Set xap-header.instance name for heartbeat
hub.c:  // If ordinary header then pass to all known listeners