Encyclopedia

1570Currently online
19Today's Reading
49Share Today
Multilingual display

watch command usage (linux monitoring status)

2018-04-24 11:12:51

You can use the watch command to set the execution interval to repeatedly interval a command or combine commands to view certain status information.

Tools/Materials

linux system

Methods/Steps
1

The command is executed at intervals and the command output is monitored. For example, watch -n 1 'ls'-n indicates the number of seconds at which the command is executed. For example, the ls command is executed once for 1s.

2

Related content Illegal climbing taken from experience

3

Execute composite commands. Sometimes the commands that refresh at intervals are composite commands, which can be implemented using -t. For example, watch -n 1 -t 'ps -ef | grep ps' The command is used to monitor the running processes that contain the ps character every second. The two commands are separated by |. In addition, -t closes the header.

4

You can use watch --help to find out more about watch.

Matters needing attention

The commands executed at intervals must be enclosed in double quotation marks (")

Recommendation