What is the purpose of the column with 0 after the numeric timestamp in .zsh_history?
: 1568128379:0;cp -a ~/.zshrc.pre-oh-my-zsh ~/.zshrc : 1568128381:0;exit Is it part of the timestamp or does it serve a different purpose altogether?
If the shell's EXTENDED_HISTORY option is set, then this number is the elapsed number of second that the command took to execute.
From the zsh manual (info zsh extended_history or the zshoptions(1) man page):
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>
This number is also displayed, in human readable "MM:SS" format, when you use the history built-in with its -D option.
Example showing sleep 7 taking 7 seconds:
% sleep 7 % tail -n 2 $HISTFILE : 1697802061:7;sleep 7 : 1697802074:0;tail -n 2 $HISTFILE % history -D -2 3158 0:07 sleep 7 3159 0:00 tail -n 2 $HISTFILE Example showing I ran mutt for 3008 seconds (50 minutes and 8 seconds) at some point:
% history -D 2070 2070 2070 50:08 mutt % sed '2070!d' $HISTFILE : 1697438226:3008;mutt As to why it may be showing as 0 for you, see Why is the duration column in .zsh_history usually 0, although the "history -D" command displays it?