time stamp on history
Posted by danielJul 11
The ‘history’ commands does not display the exact date and time of the commands executed. It just shows a numeric id followed by the command executed by the current user. Here is one way of putting a time stamp –
export HISTTIMEFORMAT='%F %T '
To make sure that it works every time you login or restart your machine, put it in $HOME/.bash_profile
Other useful environment variable related to the history command are –
1. HISTFILE
The name of the file in which command history is saved.
2. HISTFILESIZE
The maximum number of lines contained in the history file.
3. HISTIGNORE
A colon-separated list of patterns used to decide which command lines should be saved on the history list.
4. HISTSIZE
The number of commands to remember in the command history.
No comments
You must be logged in to post a comment.