Russell and Associates – Forum

December 27, 2009

Linux history – add time and date stamp to output

Filed under: Programming,System Administration — Vic @ 9:50 PM

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.
(more…)

Powered by WordPress