Repeat a command every x seconds

Say you wanted to see whenever the content of a folder changes – what to do? Easy! Use the watch command:

watch 'ls -l'

This will clear the screen and output the contents of the command and update it every 2 seconds (clearing screen before each update). The watch command works for most scripts and commands

Tip: Using Tmux and the watch command together can help you create a really cool window with a bunch of “live” updated small windows

Tested on RHEL 3

Comments are closed.

Niklas Tech Blog
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.