Thursday, July 4, 2013

Howto to add date and time to bash history

It might be useful to to log time stamp to each bash command that is being executed on server you maintain (even more if you're not the only admin there).
To keep everyone's history with time stamps edit /etc/bashrc and add:
export HISTTIMEFORMAT="%y/%m/%d %T "

for one user only edit ~./bash_profile file and add the same line.

The fields that you may use means:
%y - year
%m - month
%d - day
%T - time
%H - hour
%M - minute
%S - second

No comments:

Post a Comment