Display command execution time
Linux shell has the history function, that is, it records the commands that have been executed, but by default, it does not display the command execution time, command execution time, and history, but it is not displayed. Now let's see how to display the execution time. Simple: add the HISTTIMEFORMAT environment variable to/home/$ USER/. bashrc. The details are as follows:
After the addition is complete, execute source. bashrc to make it take effect. At this time, you can execute history to find that the time has been displayed. As follows:
Clear history
In order not to trace the execution of commands, history-c can be used to clear historical commands. For example:
History-c clears itself and its previously executed commands.
Modify retained entries in history
Sometimes we think that the history command entries retained by history are too small. If you want to save more, you can directly modify the history configuration and add the following content to. bashrc:
HISTFILESIZE = 2000 (default value: 1000)
Common history commands
History n lists the n commands that have been executed recently.
! Number: run the history command of the specified Number. There is no space between the Number and the exclamation point.
!! Repeat the previous command
List the last N historical commands
Run the command with the specified number
Repeat the previous command