«

»

Apr 24

Add timestamp to history

History is a linux shell command that list all the executed command on server. Default 1000 commands can be displayed in history.

This command is use for invistigation purpose as which command was executed to solve the issue or to malfunctioning of server.

Initally output of history command is simple linke.

989  date
990  history
991  history
992  w
993  top
994  w
995  cd /tmp
996  date

but adding timestamp it will provide you with an addational information of date and time of execution of command.
Which will help you inistigate as at what exact date and time command was executed.

To add time stamp add following.

Edit file /root/.bash_profile and add following.

export HISTTIMEFORMAT="%F %T "

Now logout from shell and login again and now execute history command you will see the difference.


contact@webhostingsupport.info

Post to Twitter

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>