Home » Linux-Unix Admin » Unix Commands » Enable Timestamp in Linux/UNIX History Command

When we run the “history” command it only gives you command along with the line numbers. Sometimes it’s useful to have a time stamp attached to each command to build a clearer picture.

Below example shows the history command output without timestamps.history-command

To enable the timestamps  in history command we have to set  “HISTTIMEFORMAT “  environment variable.

# export HISTTIMEFORMAT=”%F %T “

To permanently set this variable use  .bashrc file

Below Output shows timestamps in history commands.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>