The Linux which came together with bash-3.x RPM and HISTORYcommand show insufficient information(at least for me) as example below:
1 vi /etc/hosts
2 rpm -qa|grep bash
3 cat /etc/SuSE-release
4 history
For any SuSE Linux Enterprise server 10 that managed by more than one people, I would suggest you should make history command more user friendly and more information for auditing purposes.
Edit /etc/bash.bashrc and append to the bottom:
export HISTTIMEFORMAT="%h/%d - %H:%M:%S "
save it.
Open a new SSH session and login as usual, try typing few command and exit. Login again and type history and you should be able to see more useful information which included date and time:
1 Jun/07 - 13:23:40 sudo tail -f /var/log/messages
2 Jun/07 - 13:23:40 cat /etc/hosts
3 Jun/07 - 13:23:40 env |grep DISPLAY
4 Jun/07 - 13:23:40 ps -ef|grep startx
5 Jun/07 - 13:23:40 env
6 Jun/07 - 13:23:40 date
7 Jun/07 - 13:23:40 ps -ef|grep abc
8 Jun/07 - 13:23:40 touch abc
9 Jun/07 - 13:23:40 /sbin/ifconfig
10 Jun/07 - 13:23:40 ping planetmy.com
11 Jun/07 - 13:23:40 cat abc
12 Jun/07 - 13:23:40 date
Source : http://www.planetmy.com/blog/how-to-add-date-and-time-to-your-bash-history-on-suse-linux/
Comments
Post a Comment