# How to continuously run a command until I stop it?



## mrjayviper (Jul 4, 2015)

I guess the question is best asked with an example.

With the `tail -f`, I can continuously monitor the contents of text file. I am wondering if there's is such a thing for monitoring disk space or any other commands like continuously listing the folder directory.

Thanks a lot


----------



## tobik@ (Jul 4, 2015)

Install misc/gnu-watch. See gnu-watch(1) for examples.


----------



## DutchDaemon (Jul 4, 2015)

There's also sysutils/cmdwatch.


----------



## wblock@ (Jul 4, 2015)

Show the list of files in /tmp every two seconds:

```
sh -c 'while : ; do clear ; ls /tmp ; sleep 2 ; done'
```


----------

