Last Updated: February 25, 2016
·
554
· santiagogil

Infinit command line history

function precmd() {
    if [ "$(id -u)" -ne 0 ]; then
    FULL_CMD_LOG="$HOME/.logs/zsh-history-$(date -u "+%Y-%m-%d").log"
    echo "$USER@`hostname`:`pwd` [$(date -u)] `\history -1`" >> ${FULL_CMD_LOG}
fi
}

Each command will look like:

ahays@:<host>/home/ahays [Thu Nov 29 21:02:22 UTC 2012]   148  cat /path/to/my/favorite/textfile

Took from http://blog.andrewhays.net/love-your-terminal

TODO: write a function to extend zsh's history search.