Search And Highlight With Grep

Searching for things in many files is easy with the grep command, but in order to view the results with the expression results highlighted you need to use grep in conjunction with less.

grep expression *.txt | less +/expression

If you wanted to search all files called something.txt for the letter d you would use this line.

grep d *.txt | less +/d

Comments

nicer option would be - alias grep='grep --color=auto'
Permalink

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
14 + 3 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.