1. Defining the environment variable named HISTTIMEFORMAT as follows:
echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile
where,
%d – Day
%m – Month
%y – Year
%T – Time
2. Use the source command to load HISTTIMEFORMAT from file into the current shell script or a command prompt:
source ~/.bash_profile
3. check command "history"
sample output
986 11/03/10 04:31:36 memcached-tool 10.10.28.22:11211 stats 987 11/03/10 04:31:36 w 988 11/03/10 04:31:37 iostat 989 11/03/10 04:31:37 top 990 11/03/10 04:31:37 at 991 11/03/10 04:31:38 atop 992 11/03/10 04:31:40 collectl 993 11/03/10 04:31:41 grep CPU /proc/cpuinfo 994 11/03/10 04:31:45 vmstat 3 100 995 11/03/10 04:31:55 sar -W -f /var/log/sa/sa12