paperlined.org
sysadmin
document updated 10 years ago, on Oct 17, 2013

For CYA / audit purposes, it's helpful to record the timestamp of when individual commands are run.

If your terminal is setup to capture logs of all screen activity, putting the timestamp in your prompt is one way to do it.

Another way to do it is to have your shell's history mechanism store timestamp data.

Bash

set $HISTTIMEFORMAT

Ksh

Displaying the time in the prompt takes a little hack. See the "typeset -RZ2" section here or here.

Here's a hack for storing timestamp data in history