next up previous contents
Next: awk and sed Up: Essential administration tools Previous: cat


It searches for lines with patterns in files. It is very useful for you to get your required information from a huge system log neatly.


Get all lines with pattern ' login' in /var/log/messages. Output is displayed on standard output.

grep ' login' /var/log/messages

System Administrator
Thu Jul 26 10:50:59 HKT 2001