Linux history – add time and date stamp to output

9:50 PM in Programming, System Administration by Vic Russell

The Linux ‘history‘ command is very beneficial when trying to debug a system, remember a previously executed command, or keep track of recent steps taken in a multi-command process.  One omission to the default setup is the time and date the command was run.

There is a file in the home directory of all users called the .bashrc file (the period is not a typo – it is a hidden file).  Add the following line to get the ‘history’ output with a time and date stamp:

export HISTTIMEFORMAT="%F %T "

You can enter this at the command line and then run the ‘history’ command to view the new output.
Read the rest of this entry →