sandra_henrystocker
Unix Dweeb

Making grep output easier to see

How-To
Mar 12, 20152 mins

If you’d like your search terms to be more visible when you use the grep command, you can use an alias like this. It will put the term that you’re looking for in a different color so that you can spot it more easily on each line of text.

$ alias grep='grep --color=tty'
$ grep dark beerlist
Granny's very dark ale

This trick will also make it fairly obvious if you’re only finding the string that you’re looking for when it’s part of a longer word.

Read more on using grep:

sandra_henrystocker

Sandra Henry-Stocker was a programmer, Linux systems administrator, security engineer and Linux journalist for most of her 30-year career. She describes herself as "USL" (Unix as a second language) but remembers enough English to write books and buy groceries. She lives in the mountains in Virginia where, when not working with or writing about Unix, she's chasing the bears away from her bird feeders. Tune into her 2-Minute Linux video tutorials and take command of your command line.

More from this author