brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: watch -n 2 runs a command every two seconds and shows the latest output

Watch
~/tips/tip-watch-n

watch -n 2 'df -h /mnt/user'

Repeats any command at a set interval, so you can watch a number change without retyping it.

Waiting for a download, a rebuild or a container to come up usually means pressing the up arrow and Enter again and again. watch does that for you.

Put the command in quotes after the interval in seconds:

watch -n 2 'df -h /mnt/user'
watch -d 'ip -br addr'

The screen refreshes every two seconds. With -d, watch highlights what changed since the last run, which helps when you want to spot a counter that moves. Leave with Ctrl+C.

Caveat: watch is not installed on macOS by default (brew install watch adds it), and a very short interval on a heavy command can load the machine you are looking at.

Further reading: watch (man page), On this site: watch -d highlights what changed between refreshes

More Watch tips On the watch: Settings > SOS > Fall Detection On the watch: Settings > Noise > Noise Threshold > pick a level Open Camera Remote on the watch High Heart Rate Notifications > threshold watch -c ls --color=always -l /var/log All Watch tips (17) All topics

Link