I came across an issue few weeks back at work when I did some troubleshooting and ran some commands. When I was documenting it, I just couldn’t remember the exact time I started troubleshooting and issued those commands; I mean I even had putty logs saved for 9 hours of troubleshooting data. At that point I really felt the need to add timestamp to terminal so that I would know what I did and when.
This is our usual Linux terminal or bash shell prompt:
Added this line in .bashrc file.
export PROMPT_COMMAND="echo -n \[\$(date +%F-%T)\]\ "
and my Terminal prompt now looks like this:
Pretty neat way and saves a lot of headaches if you ask me. It’s not something new and if you’re like Jeff, then you would know it already… but I am not Jeff and not many people are, so just added this to my list of collection. Enjoy.