Generally when we try to view the history of the commands in Linux then we only see all the commands which are used but not the time when they were used. Here i will show you how you can view the time and date when the commands were used.
# history | less
1 service network restart
2 ping google.com
3 vi /etc/resolv.conf
4 ping google.com
5 vi /etc/sysconfig/network-scripts/ifcfg-eth0
6 service network restart
7 ping google.com
8 yum -y install samba
9 yum -y install quota
10 service iptables stop
Here above you can see that you are only able to view the commands which were run
# export HISTTIMEFORMAT="%d:%m:%Y %T "
# history | less
1 08:10:2012 11:31:31 service network restart
2 08:10:2012 11:31:31 ping google.com
3 08:10:2012 11:31:31 vi /etc/resolv.conf
4 08:10:2012 11:31:31 ping google.com
5 08:10:2012 11:31:31 vi /etc/sysconfig/network-scripts/ifcfg-eth0
6 08:10:2012 11:31:31 service network restart
7 08:10:2012 11:31:31 ping google.com
8 08:10:2012 11:31:31 yum -y install samba
9 08:10:2012 11:31:31 yum -y install quota
10 08:10:2012 11:31:31 service iptables stop
But the export command will be session dependent so as soon as you change session or reboot the changes won't work. So add the export line in your .bash_profile file for permanent changes.
# vi /root/.bash_profile
export HISTTIMEFORMAT="%d:%m:%Y %T "
Follow the below links for more tutorials
Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
How to configure Samba 4 Secondary Domain Controller
How to secure Apache web server in Linux using password (.htaccess)
How to register Red Hat Linux with RHN (Red Hat Network )
Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
Why is Linux more secure than windows and any other OS
What is the difference between "su" and "su -" in Linux?
What is swappiness and how do we change its value?
How to log iptables messages in different log file
What are the s and k scripts in the etc rcx.d directories
How to check all the currently running services in Linux
How to auto start service after reboot in Linux