How to ‘Watch’ Over Your Linux System Automatically

By Angsuman Chakraborty, Gaea News Network
Friday, January 2, 2009

There is a very useful but rarely used command in Linux, watch. While those of you who know about it are surely aware of all the easy works it does for you, I want to tell it to them who didn’t know about it. watch literally watches over what you intent to use it for. From your mail account to linux directory listings to interrupts - watch can watch it over for you and display the results repeatedly at your desired time interval.

1. How to watch for mails every 60 seconds

watch -n 60 from

2. How to watch the Contents of a Directory Change

watch -d ls -l

3. How to watch the Contents owned by Sam or any user in your System

watch -d 'ls -l | fgrep sam'

4. How to watch the  interrupts in 5-second intervals

watch -n 5 'cat /proc/interrupts'

5.  How to watch a long directory listing that doesn’t fit the screen

watch -d 'ls -l /usr/bin | tail -n 50'

So do you have anything else to share about this? Please feel free to drop in with your comments.

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :