Add date & time to your bash history
Sometimes you need to know when a command was executed in shell, but by default history does not show it. To enable it, just edit /etc/bashrc (global) o ~/.bashrc (per user) and add
HISTTIMEFORMAT="%h %d %H:%M:%S "
To improve the history even more, we could avoid having duplicates lines in the history:
HISTCONTROL=ignoredups:ignorespace
avoid overwriting the history file
shopt -s histappend
and setting a bigger history length
HISTSIZE=100000
HISTFILESIZE=200000
Written by Sergi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#