[[Email protected] ~]# history [n]
[Email protected] ~]# history [-c]
[Email protected] ~]# history [-raw] Histfiles
Parameters:
N: Number, meaning "to list the most recent n-Pen commands"!
-C: Eliminate all history content in the current shell
-A: Add the current New History command to Histfiles, and if there is no histfiles, the default write ~/.bash_history
-r: Read the contents of the Histfiles to the current memory of the shell;
-W: Writes the current history memory content to Histfiles!
Example:
Example one: List all history memories in memory today
[Email protected] ~]# history
# front omitted
1017 Man Bash
1018 LL
1019 History
1020 History
# The information listed is divided into two columns, and the first column is the code for the command in this shell,
# The other is the content of the instruction itself Oh! As for the show a few instructions to record, it is related to Histsize!
Example two: List the current 3 most recent data
[[Email protected] ~]# History 3
1019 History
1020 History
1021 History 3
Example three: Immediately write the current information to Histfile
[Email protected] ~]# history-w
# in the default case, the history will be written into the ~/.bash_history!
[Email protected] ~]# echo $HISTSIZE
1000
We can use the relevant features to help us execute the order! For example:
[Email protected] ~]#!number
[Email protected] ~]#!command
[[email protected] ~]#!!
Parameters:
Number: The meaning of the execution of the first few directives;
Command: the command that is searched forward by the nearest command to "command string Start command" and executes;
!! : The last instruction is executed (equivalent to pressing the ↑ key, press Enter)
Example:
[Email protected] ~]# history
The man RM
$ alias
The history of the man
History
[[email protected] ~]#!66 <== execute 66th Order
[[email protected] ~]#!! <== executes the last instruction, in this case!66
[[email protected] ~]#!al <== to execute the most recent command starting with Al (67th listed above)
Historical command: History