watch ~ how to continuously run a specific command

watch

So watch is a nice command when you want to run a command multiple times for example, when running netstat and when trying to see if the established connections are changing:

 watch -d -n0 "netstat -atnp | grep -i established"

 

-d will highlight changes occured and -n# where # is the number of seconds between the interval it runs the command, zero is instant

Posted on: Thursday 11 June 2015