From RootdevWiki

Jump to: navigation, search

A Neat PS/Grep Trick

Tired of having to continually type:

ps -ef |grep foo | grep -v grep

?

Try putting square brackets round the first character of your grep string like so:

ps -ef |grep [f]oo

And it will no longer search for itself. Neat huh?

Colour Output

$ grep --color perl arg.pl

#!/usr/bin/perl


Search for more than one string (either or):

grep "foo\|bar" filename