I am watching you

August 15th, 2006 mysurface Posted in Network, tail, watch | Hits: 49565 | 3 Comments »

To repeatly watching a certain file, such as log files, you can do that:

watch tail /var/log/messages

By default, this will be refresh every 2 seconds, and tail with list last 10 entries by default too. If you want to have specific refresh rate, you can do so:

watch -n 5 tail /var/log/messages

This will change the refresh rate to 5 seconds.

3 Responses to “I am watching you”

  1. To watch you log file, you can only do:
    tail -f /var/log/messages
    this lets you see the file in real time because the file is hold opened and new lines will be added to the end.

    But if you do it in a ssh connection, you may prefer the watch command because sessions without data may be terminated, Me too, so I would do something like
    watch -n 30 ‘tail -f /var/log/messages’
    But that won’t work, maybe because watch is waiting until the file descriptor is closed. I’m still searching for an solution, if someone know or find one, please post a comment here, thanks.

  2. wow, thanks

  3. Yesterday, while I was at work, my sister stole my iphone and tested to see if it can survive a thirty foot
    drop, just so she can be a youtube sensation. My iPad is now broken and
    she has 83 views. I know this is entirely off topic but I had
    to share it with someone!

Leave a Reply