Problem: to understand the following timestamp
1241036430
at ~/.history
: 1241036336:0;vim ~/.zshrc
: 1241036379:0;vim ~/bin/HideTopBar
: 1241036421:0;ls
: 1241036430:0;cat ~/.history
when I have
setopt EXTENDED_HISTORY
HISTFILE=~/.history
in .zshrc.
How can you read the timestamp?
Try history -d
. Or just type history -
and press control-D to get all the various options:
% history -
-D -- print elapsed times
-E -- dd.mm.yyyy format time-stamps
-d -- print time-stamps
-f -- mm/dd/yyyy format time-stamps
-i -- yyyy-mm-dd format time-stamps
-m -- treat first argument as a pattern
-n -- suppress line numbers
-r -- reverse order of the commands
You can display the whole history with human-readable timestamps using this one-liner taken from an answer on the zsh mailing list:
perl -lne 'm#: (\d+):\d+;(.+)# && printf "%s :: %s\n",scalar localtime $1,$2' $HISTFILE
I would recommend piping the output to a pager (less
for example) to make it more readable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With