Possible Duplicate:
using history command with ssh and getting output with time stamps
Basically i want to get a record of all commands executed on my ssh server, with their correct timestamps. The codes i have tried are :
ssh -i private_key user@ip 'export HISTFILE=~/.bash_history;export HISTTIMEFORMAT='%D-%T' ;set -o history; history' > myfile.txt
When i first login and then use history command, i get all details including date and time. when i use this code however, instead of getting the time at which the command was executed, i get the present time(i.e if i execute this code at 3 o clock all commands will have their timestamps as 3 o clock)