Flash Notes

Commands - Colorization of the results of "grep"


• How to colorize the results of "grep " ?

Solution

grep --color pattern file

Example 1

$ grep '^root:' /etc/passwd
root:x:0:0:root:/root:/bin/bash

Example 2

$ grep --color '^root:' /etc/passwd
root:x:0:0:root:/root:/bin/bash