Add timestamp to Bash history
Sometimes there is a need to add timestamp to bash history. At my work I found it quite useful especially when some other developers got access to the same box or when you simple want to have an idea when command from history was executed. This is how we can achieve this:
(or .bash_profile
if you use RHEL based distro) and after that just re-login or reload your profile file.
Time formatting is exactly the same like for strftime
please check man 3 strftime
.
Hint: reloading profile can be done like this:
. .profile
or source .profile
–
Cheers
Robert
Comments
blog comments powered by Disqus