history command
history command to display a specified number of the instruction command, a read command history file directory to the history and the history command buffer command buffer write command in the file directory.
When the command is used alone, only the history display command, the command line, the symbol may be used !
to perform the specified number of commands. For example, to execute the second command history, enter !2
.
Command history is stored in memory when you exit or log shell, automatically save or read. In memory, history command only capable of storing 1000 history command, which is by the number of environment variables HISTSIZE
to control.
grammar
history (Option) (parameters)
Options
- C: Clear the current command history; - A: The history command buffer write command in the command file history; - R & lt: the command history file command reads the current command history buffer; - W : the current command history write buffer command history command file.
parameter
n: n recent print commands.
Examples
Using the history command to display the 10 most recently used command history, enter the following command:
[root@localhost ~]# history 10 92 ls 93 cd .. 94 ls 95 exit 96 ls -a 97 cd .ssh/ 98 ls 99 cat known_hosts 100 exit 101 history 10