Skip to content

‘watch’ for Solaris (or any other machine with bash)

Solaris variants (i.e. Nexenta) seem to lack the ‘watch’ program that’s so useful on Linux/BSD.  There are several people asking for this on various forums.

There might be a port available, but not stock on machines, and if your machine is inside a restrictive firewall, it might be hard to get.  In a pinch, the following seems to work fine:

while /bin/true ; do clear; date; echo; ps ax | grep send; sleep 5; done

Where ‘ps ax | grep send’ is an example of the command to be used. All the rest is boilerplate. Adjust the ‘5’ as you would the ‘-n’ parameter.  No doubt a simple shell script could be made to act like real ‘watch’.