Reputation: 932
I have added:
export HISTTIMEFORMAT="%d/%m/%y %T "
to my .bashrc file so that when I execute history
I get a time-stamped list of commands.
However when I shut down and open my ssh session again, all previous commands' time stamps are set to the time I connected to the ssh session. Is there a way to keep the correct time stamps between ssh sessions?
Upvotes: 0
Views: 1902
Reputation: 584
According to https://www.digitalocean.com/community/tutorials/how-to-use-bash-history-commands-and-expansions-on-a-linux-vps, you may try to flush history as soon as commands are executed.
BTW, having a look at ~/.bash_history
will show you that the command timing is stored as a preceding commented line with unix time stamp. If the commented timestamp line is missing, the current time is used.
Upvotes: 1