Transferred from: http://blog.chinaunix.net/uid-24500107-id-2602908.html
The history command is available on both Inux and UNIX to query previously executed command histories
However, this record does not contain time items
So I can only see the command, but I don't know what time it takes.
How do I get history to record time?
Solution Solutions
Note: This method is only valid for versions above bash-3.0
Execute RPM-Q bash to show the version of Bash
For common Linux AS4, AS5, are valid
---------------------------------------------
To edit the/ETC/BASHRC file, add the following three lines:
histfilesize=2000
histsize=2000
histtimeformat= "%y%m%d-%h%m%s:" or histtimeformat= "%y%m%d%T"
Export Histtimeformat
or a word:
echo "histfilesize=2000" >>/ETC/BASHRC && echo "histsize=2000" >>/etc/bashrc && Echo ' Histt imeformat= "%y%m%d%T" >>/etc/bashrc && export Histtimeformat
How to make the history command of Linux show the time record