60

This must've been done before: I want to keep a log file open in terminal so I can monitor updates to it as they occur. My searches are coming up with everything but this situation... I must be missing some terminology or something key, because people do this all the time inside of other programs (NetBeans, or rails server, for example).

Hennes
  • 65,804
  • 7
  • 115
  • 169
wulftone
  • 973

3 Answers3

113

Try with:

tail -f your.log

where -f stands for follow.

cYrus
  • 22,335
10

Another way:

watch tail -n20 your.log

OK, kind of a silly use of watch - but you might find the watch command useful for other things.

Robin Green
  • 1,325
4

An alternative to @cYrus's answer is:

less +F file.log

The benefit is that less can also truncate long lines for you with the -S flag, preventing them from wrapping around the terminal screen while allowing you to scroll left/right. Instead of piping tail -f file.log through cut or something similar, you can just:

less -S +F file.log