Spread knowledge in your company: Print out 1-pagers and display them at the water cooler
Navigation Menu+

less +F for viewing logs

Posted on Apr 22, 2015 by in Development, DevOps & SysAdmins | 0 comments

Brian Storti wants you to stop using tail -f (mostly). He laid out his points so compellingly that we want to help spread the message with something readily printable. Enjoy 🙂

Get PDF

Never miss a 1-pager – Subscribe to our free newsletter!

Content of 1-pager:

When you are monitoring a single file, consider using less +F over tail -f. At first they do the same thing, but less +F allows you to switch from watch mode into a navigation mode with ctrl-c (and
back to watching with F).

In navigation mode you can use the usual less commands, such as:

  • Search “foo” with /foo
  • Jump to the next occurence with n or the previous with N
  • Go up with j or down with k
  • Create marks with m

If you use rotating logs, check out the –follow-name option.

When you are monitoring multiple files, you’ll probably prefer tail -f because it will show you changes in all monitored files whereas less +F will only show you the first file (unless you use ctrl-c, :n, F to switch between buffers).

Also stick with tail -f if you want to insert empty lines as a visual separation.

Submit a Comment

Your email address will not be published. Required fields are marked *