Using the watch command
Another command that is very useful for system administration is the watch
command. Even better is the fact that the watch
command is extremely easy to learn as what it does is simple. It repeats the command typed immediately after it every two seconds by default. For example, you can view the output of the ls
command every two seconds by typing the following command:
watch ls /home/user
This is not very exciting, is it? To illustrate what ls
does, open another terminal window. In that window, create a new file in your home directory. You should see the new file appear in the output of the first window. If you delete the file, you'll see the file disappear from the watch
output.
Note
To break out of the watch
command, press Ctrl + C on your keyboard.
While this may be useful for monitoring a single directory, it may not be a very exciting example. For an even better example, try the following command:
sensors
As long as your motherboard supports it, the sensors
command...