In bash, watch (e.g. watch -n 5 ls -l) could be used to repeat the command at fixed intervals.
This command seem to be missing on zsh. Is there an equivalent?
watch is not an internal command:
$ type watch /usr/bin/watch so make sure it installed on the system where you are running zsh.
brew install watch. stackoverflow.com/a/23370705/1175956 I just improvised watch with: clear; while ls -lah; do sleep 2; clear; done
Interesting idea. I could write a function around that... Right, put this in your .zshrc
watch () { IN=2 case $1 in -n) IN=$2 shift 2 ;; esac printf '\033c' # clear CM="$*" LEFT="$(printf 'Every %.1f: %s' $IN $CM)" ((PAD = COLUMNS - ${#LEFT})) while : do DT=$(date) printf "$LEFT%${PAD}s\n" "$HOST $(date)" eval "$CM" sleep $IN printf '\033c' done } -d, -g, etc? As pointed out by @Han, if you use that script that he made you will also be able to run commands using your local aliases, and also preserve terminal colors.
watchis not a builtin. It is an external command.