The watch command executes the command periodically, displaying the output in full screen. A program can be repeatedly executed by the Watch command to monitor its output changes.
Command format
Watch [-DHVT] [-n <seconds>] [--differences[=cumulative]] [--help] [--interval=<seconds>] [--no-title] [-- Version] <command>
Command parameters
-N,--interval
Specify a time interval. By default, watch executes the command every 2 seconds.
-D,--differences
Highlight the area of change. The-d=cumulative option highlights all areas that have changed (including those that have been changed).
-T,-no-title
Close the time interval, commands, and so on that appear at the top.
-H,--help
Show Help Document
Instance
A) All TCP protocol connections are displayed every 2 seconds
Watch Netstat-ant
b) Display of user information logged in every 30 seconds
Watch-n W
c) Monitor a file to highlight its changing content
Watch-d Cat/proc/loadavg
Linux Commands-Watch: Execute commands repeatedly, full screen display output