The Linux watch Command The watch command in Linux provides a way to handle repetitive tasks. By default watch will repeat the command that follows it every two seconds. As you can imagine, watch is a great tool to keep an eye on log files. Here's an example. watch tail /var/log/syslog In order to stop the command execution, just use the standard kill sequence, [Ctrl]+C. Using the Linux watch command to monitor the syslog You can change the time interval by issuing the -n switch and specifying the interval in seconds. To check the log file every 10 seconds, try this. watch -n 10 tail /var/log/syslog The Linux watch Command with a Pipe The watch command isn't limited to viewing log files. It can be used to repeat any command you give it. If you have your system set up to monitor the CPU temperature , you can use watch to view that with the sensors command. watch -n 1 sensors acpitz-virtual-0 Adapter: Virtual device temp1: +45.0°C (crit = +100.
Read full article from Linux watch Command with pipe
No comments:
Post a Comment