watch
noun
say it: “WAHCH” /wɑtʃ/
A command that reruns another command every few seconds and shows only its latest output, until you stop it.
What does watch do?
watch runs a command over and over and shows only its latest output, so you can see something change without pressing the up arrow and Enter. -n 5 runs it every five seconds (two is the default), and Ctrl+C stops it. Put a command with a pipe in quotes, so the pipe belongs to the command, not to watch.
watch -n 5 ./test.sh
watch -n 2 'ls site | wc -l'
In a sentence
- “watch -n 5 ./test.sh reruns the tests every five seconds.”
- “Sam ran the tests under watch and saw contact.html turn from 404 to 200.”
Level: Apprentice · More Unix terms at this level
Updated