Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ssh tail output lines only with keyword

Tags:

ssh

tail

I'm trying to tail a large file in an ssh command prompt, but I need to filter it so it only displays lines that contain a particular keyword in them.

I'm using this command currently to tail.

# tail /usr/local/apache/logs/access_log

If possible please let me know what I would add to this command to accomplish this.

like image 557
sven30 Avatar asked Jul 22 '13 02:07

sven30


1 Answers

You can pipe the output of tail and use grep. To

filter so it only displays lines that contain a particular keyword in them

you could do:

tail /usr/local/apache/logs/access_log | grep "keyword" 

where you'd replace keyword with your keyword.

like image 180
vee Avatar answered Jan 04 '23 03:01

vee