View Full Version : [ubuntu] timestamps in terminal output

February 13th, 2010, 12:57 AM
I sometimes need to prove I did things in a certain order when using the terminal. For example when calculating hashs of disk images I have to show that image x was done before y and z. Is there a way to print a timestamp with the command line output? Thanks

February 13th, 2010, 01:12 AM
If you'd like the time with every command, you might check bash's PROMPT_COMMAND shell variable.

Put the date command into it. See date --help.

Or perhaps you could write a script that prints the date before each relevant command, e.g.:

echo -n "`date --rfc-3339=ns` "
./hash_cmd disk1.img