Marty Wallace Marty Wallace - 1 year ago 188
Linux Question

Linux repeat command automatically

Is it possible in linux command line to have a command repeat every n seconds.

For example, say I have an import running and i am doing

ls -l

to check the file size is increasing. I would like to have a command to have this automatically repeat.

Answer Source

Watch every 5 seconds ...

watch -n 5 ls -l

If you wish to have visual confirmation of changes, append --differences prior to the ls command.

According to the OSX man page, there's also

The --cumulative option makes highlighting "sticky", presenting a running display of all positions that have ever changed. The -t or --no-title option turns off the header showing the interval, command, and current time at the top of the display, as well as the following blank line.

Linux/Unix man page can be found here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download