I'm trying to add timestamps to my history output. I am running Z Shell on a Mac (Monterey v12.2).
I have the following in my .zprofile
regarding history.
export HISTSIZE=5000
export HISTFILE=~/.zsh_history
export SAVEHIST=5000
export HISTFILESIZE=5000
export HISTTIMEFORMAT='%F %T '
setopt appendhistory
alias hist="history 1"
I know my .zprofile
is being loaded since other variables and alias
statements are working. However my history does not include any timestamp currently.
It looks like this:
$ hist
1008 ls -lah
1009 npm install
1010 clear
1011 git status
1012 npm install
1013 npm start
1014 clear
1015 git status
1016 vim .gitignore
1017 git status
1018 git add .gitignore
How can I make sure my history
makes use of the HISTTIMEFORMAT
?
HISTTIMEFORMAT
is specific to bash - see for example How to view datetime stamp for history command in Zsh shell – steeldriver Feb 02 '22 at 14:03