Time to Execute Terminal Commands

Ever wonder how long it took to run a long script?

Just add time to it. Literally.12

time ls
time sleep 1
time wp search-replace "http:" "https:"

And it’ll tell you how long the command took to run.

real  3m32.090s
user  0m3.949s
sys   0m3.002s

Zsh Formatting

Zsh uses a different time format by default (it puts everything on one line, harder to read). To get the format I’m showing here, add this snippet to your .zshrc.3

TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S'

References