2

How to start a command for example ls -la every 5 seconds on Solaris ? . I'm searching for something like watch -n 5 ls -la

  • and what's wrong with watch ? – Carpette Mar 3 '16 at 13:25
  • @Carpette, I'm not sure it comes with a default Solaris installation; I see a 3rd-party package available at opencsw.org/packages/CSWwatch – Jeff Schaller Mar 3 '16 at 13:27
  • FWIW OpenCSW is a pretty common repo for installing software on Solaris. I would just as a matter of best practice have it available unless you have a reason to leave it off (security clearance or some such). – Bratchley Mar 3 '16 at 13:40
5

You can make a script using sleep, as described in this ticket Basically, this make something like that:

while true
do 
    ls -la
    sleep 5
done

You can launch this in a screen if you want to reach it at any moment, or you can redirect the output in a file that you can consult at any time (because i think screen, as watch, isn't installed with the basic solaris installation).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.