Timed Terminal Commands
Lesser Known Trick. Add this to ~/.zshrc
or anything equivalent.
preexec() {
timer=$(gdate +%s.%N)
}
precmd() {
if [ -n "$timer" ]; then
now=$(gdate +%s.%N)
elapsed=$(echo "$now - $timer" | bc)
timer_show=$(printf "%.2f" $elapsed)
echo "โฑ ${timer_show}s"
unset timer
fi
}