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

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">

This site uses Akismet to reduce spam. Learn how your comment data is processed.