Historical command: History

Source: Internet
Author: User

[[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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.