-->
🏠 🔍
SHAREOLITE

Timestamp in linux History command - SOLVED


By setting the the parameter HISTTIMEFORMAT in .bashrc script under a linux user, timestamp can be appended to each command executed by the user in .bash_history file.
 

 


Add the below line in .bashrc file of a OS user.

export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "

Sample command history output

 1002  2014-08-06 22:41:56 hello
 1003  2014-08-06 22:41:57 history
 1004  2014-08-06 22:42:04 who am i
 1005  2014-08-06 22:42:09 who
 1006  2014-08-06 22:42:11 who am
 1007  2014-08-06 22:42:13 who am i
 1008  2014-08-06 22:42:16 whoami
 1009  2014-08-06 22:42:21 history

Hope this helps to some linux geeks.



Comments

–>