Last Updated: February 25, 2016
·
3.744K
· sheerun

Make 'less' behave like 'tail -f'.

less +F somelogfile

Using +F will put less in follow mode. This works similar to 'tail -f'. To stop scrolling, use the interrupt. Then you'll get the normal benefits of less (scroll, etc.).

Pressing SHIFT-F will resume the 'tailling' (actually you can start less without any parameters and press SHIFT+F afterwards to enable tailing)

Also, you can use -W flag to highlight the first (unread) new line after any forward movement such as scrolling to the next page.

  • Pressing SHIFT+CTRL+C (on windows) will put you back into normal mode
  • Pressing SHIFT+F will resume the 'tailling' (as mentioned above)
  • Pressing g will take you to the beginning of the file
  • Pressing SHIFT+G will take you to the end of the file
  • Pressing f will forward you one page
  • Pressing b will take you back one page
  • Pressing q will quit the program

Also, you can search backward by typing ?searchterm.

If you want to display colors, use an additional -R flag.

Source: commandlinefu, superuser