history is a linux shell command which list all executed command on server. By default history command can display 1000 commands.
This command is use for invistigation purpose as which command was executed to solve issue or if any wrong command was executed to malfunctioning of server.
By default output of command is simple like:
Now adding timestamp will show you a detail output with date time and command.HTML Code:989 date 990 history 991 history 992 w 993 top 994 w 995 cd /tmp 996 ls -la
To ad time stamp SSH to server as root and edit file /root/.bash_profile with your favorite editor and add following line.
now logout of shell prompt and login again and execute history command, you will see detail output.HTML Code:export HISTTIMEFORMAT="%F %T "
Note: Edit file /root/.bash_profile carefully, do not mess it up.HTML Code:root@Server[~]#history 19 04/25/10 08:26:48 hostname 20 04/25/10 08:46:34 history 21 04/25/10 08:46:48 w 22 04/25/10 08:46:50 date 23 04/25/10 08:46:52 cal 24 04/25/10 08:46:53 ls -la 25 04/25/10 08:46:55 top 26 04/25/10 08:47:11 tail -f /var/log/messages 27 04/25/10 08:47:29 history






Reply With Quote
Bookmarks