Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
1  
This is often called “tailing”, after tail -f. See also How to have tail -f show colored output and more generally the tail tag. –  Gilles May 5 '11 at 22:41
add comment

1 Answer

up vote 11 down vote accepted

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.

share|improve this answer
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 6 '11 at 0:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.