How to view the history with the actual timestamp for the commands?
Hello Friends,
Please could anyone help me to get the actual timestamp using history for the commands typed as user or root. I have tried using export HISTTIMEFORMAT="%F %T " and then the history does not give me the actual timestamp, it is showing the current timestamp for all the commands in the history. SO I would like to understnad if it is possible to get the actual timestamp for the history command. It will help me to identify who did/what did/ and when did on my servers. Aprreciate your help in this. |
You can try with 'export HISTTIMEFORMAT="%d/%m/%y %T "'.
Just add the 'export' command to your '.bash_profile': Code:
echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile Code:
source ~/.bash_profile |
You are great. Thank you very much for the help.
|
Dear Friends,
I have tried it in bash and its working superb. But what should I do for C-shells and K-shells. I have tried a bit but nothing worked.please could anyone suggest. |
In C-shell use setenv command instead of export cmd.
Code:
~$ setenv HISTTIMEFORMAT "%d/%m/%y %T " Code:
~$ echo 'setenv HISTTIMEFORMAT "%d/%m/%y %T "' >> ~/.cshrc |
ksh:
1. try http://www.howtoguides.com/computers.../history.xhtml as referenced in http://h30499.www3.hp.com/t5/Languag...e/td-p/4763299 2. alternately (if that won't work) go to the latter thread and just after that ref (2 posts down) see another option using trap cmd. |
Thank you.
It didnt helped me...still I am seeing the history output with time only. Is there any other options. Also for k-shell also nothing helped me as of now. Please any advise. |
Quote:
If your concern is just to check the history of commands for a particular user, then check that user's /home/username/.bash_history file. On the other hand, you can check your systems various logs (i.e. /var/log/... files) to find out who and what a user did on your server. The command: Code:
~$ setenv HISTTIMEFORMAT "%d/%m/%y %T " Code:
~$ history |
All times are GMT -5. The time now is 04:32 AM. |