I saw the option extended_history and saw it being used as in Per-directory history in zsh but haven't really understood what does extended_history actually do ?
What info. would become available in zsh_history which otherwise wouldn't if this option is not set.
From http://zsh.sourceforge.net/Doc/Release/Options.html#Options it says about -
EXTENDED_HISTORY <C>
Save each command’s beginning timestamp (in seconds since the epoch) and the duration (in seconds) to the history file. The format of this prefixed data is:
‘: <beginning time>:<elapsed seconds>;<command>’.
But I don't see any benefit to it at least while running the history command -
shirish@debian ~ % history | grep tail -5
601* exit
602* history
603* exit
604 cd
605 cat ~/.zsh/.zshrc
606 tail -5 history
This is how my ~/.zsh/.zshrc
is set up -
shirish@debian ~ % cat ~/.zsh/.zshrc
# Lines configured by zsh-newuser-install
HISTFILE=~/.zsh//.histfile
HISTSIZE=1000
SAVEHIST=100000
setopt inc_append_history autocd nomatch notify share_history extended_history
bindkey -e
# End of lines configured by zsh-newuser-install
# display how long all tasks over 10 seconds take
export REPORTTIME=10
# The following lines were added by compinstall
zstyle :compinstall filename '/home/shirish/.zsh//.zshrc'
autoload -Uz compinit promptinit
compinit
promptinit
# End of lines added by compinstall
prompt adam1
I didn't see any difference either after setting the option or taking it out, no meaningful difference.
shirish@debian ~ % cat ~/.zsh/.zshrc | grep setopt
setopt inc_append_history autocd nomatch notify share_history extended_history
shirish@debian ~ % source ~/.zsh/.zshrc
shirish@debian ~ % history -E
337 11.1.2018 23:33 history | grep apg
338 11.1.2018 23:33 man apg
339 11.1.2018 23:33 cd
340 11.1.2018 23:33 apg -a 1 -M n -n 3 -m 20
341 11.1.2018 23:33 apg -a 1 -M SNCL -n 3 -m 20
342 11.1.2018 23:33 history
343 11.1.2018 23:33 history -E
344 11.1.2018 23:33 leafpad ~/.zsh/.zshrc
345 11.1.2018 23:33 cat ~/.zsh/.zshrc
346 11.1.2018 23:33 source ~/.zsh/.zshrc
347 11.1.2018 23:33 history -E
348 11.1.2018 23:33 exit
349 11.1.2018 23:33 history -E
350 11.1.2018 23:34 leafpad ~/.zsh/.zshrc
351 11.1.2018 23:35 cat ~/.zsh/.zshrc | grep setopt
352 11.1.2018 23:35 source ~/.zsh/.zshrc
shirish@debian ~ % leafpad ~/.zsh/.zshrc
shirish@debian ~ % source ~/.zsh/.zshrc
shirish@debian ~ % history -E
340 11.1.2018 23:33 apg -a 1 -M n -n 3 -m 20
341 11.1.2018 23:33 apg -a 1 -M SNCL -n 3 -m 20
342 11.1.2018 23:33 history
343 11.1.2018 23:33 history -E
344 11.1.2018 23:33 leafpad ~/.zsh/.zshrc
345 11.1.2018 23:33 cat ~/.zsh/.zshrc
346 11.1.2018 23:33 source ~/.zsh/.zshrc
347 11.1.2018 23:33 history -E
348 11.1.2018 23:33 exit
349 11.1.2018 23:33 history -E
350 11.1.2018 23:34 leafpad ~/.zsh/.zshrc
351 11.1.2018 23:35 cat ~/.zsh/.zshrc | grep setopt
352 11.1.2018 23:35 source ~/.zsh/.zshrc
353 11.1.2018 23:35 history -E
354 11.1.2018 23:36 leafpad ~/.zsh/.zshrc
355 11.1.2018 23:36 source ~/.zsh/.zshrc
shirish@debian ~ % cat ~/.zsh/.zshrc | grep setopt
setopt inc_append_history autocd nomatch notify share_history
As can be seen there doesn't seem to be any difference.
% zsh --version
zsh 5.4.2 (x86_64-debian-linux-gnu)
-E
on thehistory
command to show the timestamps whenEXTENDED_HISTORY
is on or off between different invocations of the shell? – thrig Jan 11 '18 at 14:45