The grep command – one of the most popular Linux commands, and definitely deserving of a feature video in the Linux Essentials series. In this video, Jay goes over the basics of the grep command, along with some useful examples.
Colorized Output in grep
If you’re at all curious why grep in my video shows colorized output, you can achieve the same by adding the following to your .bashrc
file:
alias grep='grep --color=auto'
characters.txt (Example file for practicing grep)
Name: Alan Grant Occupation: Paleontologist Species: Human
Name: Batman Occupation: Vigilante Species: Human
Name: Dalek Occupation: Dalek Species: Dalek
Name: Doctor Occupation: Time Traveler Species: Time Lord
Name: Donatello Occupation: Ninja Species: Mutant Turtle
Name: Kefka Occupation: Court Mage Species: Human
Name: Kirby Occupation: Cute Pink Puff Species: Kirby
Name: Leonardo Occupation: Ninja Species: Mutant Turtle
Name: Michelangelo Occupation: Ninja Species: Mutant Turtle
Name: Raphael Occupation: Ninja Species: Mutant Turtle
Name: Riddler Occupation: Super Villian Species: Human
Name: Samus Occupation: Bounty Hunger Species: Human
Name: Terra Occupation: Hero Species: Esper