r/linux • • Mar 30 '15

Stop using tail -f (mostly)

http://www.brianstorti.com/stop-using-tail/
830 Upvotes

219 comments sorted by

View all comments

7

u/RandomDamage Mar 30 '15 edited Mar 30 '15

My most common use case for tail -f is "tail -f foo.log | grep search_string", which won't work the same with less

That said, this is a pretty neat less trick.

(After reading this, I think I'm going to be using "tail -F foo.log | grep --line-buffered search_string | less" to get all the features!)

[edit] Updated command line due to additional information in response.

5

u/tehmatticus Mar 30 '15

To mimic this in less, you can do less foo.log and then when inside less, hit the & character and type your search string to filter for that string, then hit F to follow the log.

1

u/RandomDamage Mar 30 '15

Interesting. After testing I see that you can do multiple filters that way, also.