4

Right now I'm essentially executing tail /var/log/syslog manually every once in a while. Is there something that lets me see what's being added continuously, or do I need to write something myself?

Kit Sunde
  • 4,504
  • 10
  • 31
  • 34

1 Answers1

11

I believe you're looking for the -f switch. It will continue to follow the the log file as it changes.

tail -f /var/log/syslog

You can vary the number of lines that are output using the -n switch as well:

tail -f -n 20 /var/log/syslog

See man tail for more information.

cjm
  • 27,160
  • 3
    tail -f | grep ... | while read line; do ...; done is an extremely common scripting idiom among sysadmins. (Yes variants of of it using popen() styled subprocesses count as using the same idiom). It's used to selectively process logged events in near real-time (for example to send alerts or initiated automated remediation scripts). – Jim Dennis May 06 '11 at 00:58