How to Add Date And Time To Your Bash History on SuSE Linux
Posted by Planet Malaysia on June 7, 2009
The SuSE Linux Enterpise 10 which came together with bash-3.x RPM and HISTORY command 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
Note: This HISTTIMEFORMAT is NOT available on SuSE Linux 9 under bash-2.x RPM.
Hope this is helpful!
Possibly Related Posts:
- Google Public DNS Down?
- lppasswd: Unable to open passwd file: Permission denied
- Missing /var/log/lastlog
- Telnet service_limit error
- Google accounts on Twitter
Comments
Leave a Reply