2025-12-17 07:31 UTC
The watch command is very useful, for those who don’t know, it starts an automated loop with a default of two seconds and executes whatever commands you place after it.
It allows you to actively monitor systems without having to manually re-run your command.
So for instance, if you wanted to see all storage block devices and monitor what a new storage device shows up as when you plug it in, you could do:
watch lsblk
And see in real time the drive mount. Technically not “real time” because the default refresh is 2 seconds, but you can specify shorter or longer intervals.
Obviously my example is kind of silly, but you can combine this with other commands or even whole bash scripts to do some cool stuff.
Replies (1)
-
@Breadhax0r@lemmy.world 2025-12-17 11:38
Ooooh cool, I think this explains how they have our raid monitor set up at work! I keep forgetting to poke through the script