The Linux ‘watch’ command allows you to display the output of a regualr command and update the screen if the output changes.

 

-d allows changes to be highlighted

 

-n (#) displats the inveral that would be updated in seconds.

 

-t turns off display header

 

-g If a change in output is detected, it will exit command.

 

Watch will continue to run until its closed by control+c or closing the cli terminal window

 

(Ctrl + Z is used to suspend a process by sending it the signal SIGSTOP , which is like a sleep signal, that can be undone and the process can be resumed again.)

 

Examples

 

1. Directory contents chaning

 

watch -d ls -la

 

2. Disk space grown or shrink

 

watch -d df -h

 

3. watch -d ‘ls -l | fgrep janis

 

4. watch -n 60 from

 

5 watch -g free