ack is grep like command which is more faster and powerful, it is not installed by default on most distros, you can fcheck the following link regards how to install it

ack: Installation


search exact word under current directory (include all sub directories)

ack -w eat

please note: -w means exact match, so the result won't return any line like "meat", "eating"

if you want to include line contains string "eat", you could remove the -w parameter

ack eat

search current directory but ignore certs directory

ack eat --ignore-dir=myfolder1

only search for certain type of file

ack --html onclick

to find out the types of files ack support, you can

ack --help-type

by default recursive search is enabled, to turn off you can

ack -n --html onclick

to search ignore case

ack -i onclick

passthru function, it highlights the patterns you defined from the other end of the pipe

for example, you want to highlight certain ip address from apache access.log, you could

tail -f access.log|ack --passthru

or you could highlight multiple patterns like

tail -f /opt/opennms/logsdaemon/poller.log|ack --passthru "ssh|icmp"

if you want show only the line match the pattern (like grep), you could

tail -f access.log|ack --filter