in Technology

Even after all these years, I am still amazed by how complete of a toolbox I have at my disposal when I’m working in UNIX-like (more specifically GNU/Linux) operating systems. This goes from powerful tools like grep and sed to simpler ones like the command I discovered yesterday.

I wanted to run a command infinitely at regular intervals (say 10 seconds) and watch its output.

I could have written a quick script in Bash, but what if there was a even simpler solution? Yes, in fact there is!

$ watch -d -n 10 'find /tmp/inc -type f | wc -l'

With the -d option it even highlights output differences!

Here’s the man page for watch.