History commands in CentOS: history
[Root @ linux ~] # History [n]
[Root @ linux ~] # History [-c]
[Root @ linux ~] # History [-raw] histfiles
Parameters:
N: Number, which indicates "List of the nearest n commands!
-C: removes all history content in the current shell.
-A: adds the newly added history command to histfiles. If histfiles is not added,
Write by default ~ /. Bash_history
-R: Read the content of histfiles to the history Memory of the current shell;
-W: Write the Current history Memory to histfiles!
Example:
Example 1: List all history memories in the current Memory
[Root @ linux ~] # History
# Omitted earlier
1017 man bash
1018 ll
1019 history
1020 history
# The information listed is divided into two columns. The first column shows the code of this command in this shell,
# The other is the instruction content! As for how many Command records will be displayed, it is related to HISTSIZE!
Example 2: List the latest 3 Documents
[Root @ linux ~] # History 3
1019 history
1020 history
1021 history 3
Example 3: immediately write the current data to histfile
[Root @ linux ~] # History-w
# The historical records are written to ~ by default ~ /. Bash_history!
[Root @ linux ~] # Echo $ HISTSIZE
1000