Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On Linux systems I can

watch -n1 tail /var/log/whatever.log

or

watch -n1 grep somestuff /var/log/whatever.log

To show updates to a log every 1 seconds. On FreeBSD however, the watch command does something else entirely. Who knows a good FreeBSD command for what I'm trying to do? =)

share|improve this question

4 Answers 4

up vote 17 down vote accepted

How about this: $ tail -f logfile?

And if you need to grep: $ tail -f logfile | grep foobar.

share|improve this answer
    
On linux you generally have "tailf" which has the advantage of "not accessing the file when it is not growing". –  Shadok Mar 4 '11 at 17:44

You could write a quick shell loop:

while sleep 1; do clear; grep somestuff /var/log/whatever.log | head -n 18; done

share|improve this answer

If I define your "what I'm trying to do" as "watch changes to a log file", I would suggest rather than using watch that you could just use the "-f" (for "follow") or "-F" option on the tail command, as in tail -f /var/log/whatever.log. The output can also be piped through grep to give you the filtered version you show there. I believe this is also likely to be more efficient than "watch".

Edit: I thought the "follow" option wasn't available on BSD but it appears it is. Must have been thinking of something else that's not there...

share|improve this answer
1  
There are the same -f and -F options to tail on FreeBSD. –  Dennis Williamson Apr 14 '10 at 21:38
Port:   gnu-watch-3.2.8
Path:   /usr/ports/misc/gnu-watch
Info:   GNU watch command
Maint:  ehaupt[ woof-woof ]FreeBSD.org
B-deps: 
R-deps: 
WWW:    http://procps.sourceforge.net/
share|improve this answer

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.