Issue
- How to display the timestamp for
history
command? - Unable to see timestamp for
history
command
Resolution
- Typically when you type history from a command
line, it displays the command # and the command. For auditing purpose,
it may be beneficial to display the time stamp along with the command as
shown below:
# export HISTTIMEFORMAT='%F %T '
- Or, to make the change permanent for the current us
$ echo 'export HISTTIMEFORMAT="%F %T "' >> ~/.bashrc
$ source ~/.bashrc
- Then run the history command:
# history
1 2012-07-12 19:02:39 service network restart
2 2012-07-12 19:02:39 exit
3 2012-07-12 19:02:39 id
4 2012-07-12 19:02:39 cat /etc/redhat-release
No comments:
Post a Comment