Post History
The preexec function is called right before executing commands, so it's the place to do this sorta things. This solution is adapted from Dan Berindei's original answer (CC BY-SA 3.0) to a related ...
Answer
#1: Initial revision
The `preexec` function is called right before executing commands, so it's the place to do this sorta things. This solution is adapted from [Dan Berindei's](https://stackoverflow.com/users/55870/dan-berindei) [original answer](https://stackoverflow.com/a/14084584/9309049) (CC BY-SA 3.0) to a related question: ```zsh preexec () { TIME=`date +"[%H:%M:%S]"` C=$(($COLUMNS-12)) echo -e "\033[1A\033[${C}C ${TIME} " } ``` Just paste it in your `.zshrc` file. It uses [ANSI excape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) to print the timestamp to the previous line (prompt line). Note that you will likely need to modify the columns count if you change the timestamp format.