Tuesday, January 22, 2013

History command With Date and Time In Linux.



Add the line at end of file.

[root@neonserv ~]# vi  /etc/bashrc

# vim:ts=4:sw=4
##
test -s /etc/bash.bashrc.local && . /etc/bash.bashrc.local


Create one file name  "/etc/bash.bashrc.local"  and edit like as follows.

[root@neonserv ~]# vi /etc/bash.bashrc.local

#local bashrc mods
#
# turn on date time stamps in history
#
export HISTTIMEFORMAT="%h/%d - %H:%M:%S "
export HISTCONTROL=ignoreboth
export HISTSIZE=2000

---------------------------
So when you will fire command output will be like this:
[root@neonserv ~]# history
 1033  Jan/22 - 15:30:44 accton
 1034  Jan/22 - 15:31:16 /etc/init.d/psacct start
 1040  Jan/22 - 15:32:06 lastcomm shrii
 1041  Jan/22 - 15:32:10 lastcomm root
 1042  Jan/22 - 15:32:38 lastcomm
 1043  Jan/22 - 15:32:48 lastcomm rm
 1044  Jan/22 - 15:32:51 lastcomm ls
 1045  Jan/22 - 15:32:53 lastcomm root
 1050  Jan/22 - 21:49:44 history
--------------------------


5 comments:

Milon Khan said...


Blog and blog would be of advantage, Thank you for providing information about the update.
Meditation Blogs

latesttechnologyblogs said...


Really good information to show through this blog. I really appreciate you for all the valuable information that you are providing us through your blog. Google cloud computing Online training

Renu said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops Training in electronic city

Adithya e-Learning said...

I really love it and amazing information in this blog. it's really good and great information well done. UNIX and Linux Administration.

bhanu sree said...

Good post!!!!!
Azure online training in ameerpet
Microsoft azure training
Azure devops online
Microsoft Azure DevOps Training
Microsoft Azure DevOps Online Training
Microsoft Azure DevOps training hyderabad
Azure DevOps online training in hyderabad