Add time stamp to commands in linux history

Some times we need to know at what time someone executed a command. We can add the time stamp to the commands displayed in the history.

echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile ; source ~/.bash_profile

Then type history command and it will display the commands executed with their timestamp. e.g.

873 18/05/16 05:18:05 docker pull ubuntu
874 18/05/16 05:18:05 docker images
875 18/05/16 05:18:05 docker tag ubuntu:latest slcn09vmf0022.us.oracle.com:/5000
876 18/05/16 05:18:05 docker ps
877 18/05/16 05:18:05 docker stop bkdevregistry
878 18/05/16 05:18:05 dockedr rm bkdevregistry

 

Advertisements

About Divyashree - The GNULINUX Guy

I am a Linux and Opensource enthusiast. I started working on Linux early in 2007 while I was doing my Masters in Computer Science and passed out in 2010. Currently working as a DevOps Developer in in Public/Private cloud domain. my @github : https://github.com/kumarprd my @nagiosexchange : https://exchange.nagios.org/directory/Owner/divyaimca/1 my @linkedin : https://www.linkedin.com/in/priyadarshee-kumar-☁-a9415615
This entry was posted in HOWTO, TIPS & T RICS, Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s