"Linux command in detail" 10, View History command-[historical]

Source: Internet
Author: User

10. History
You can view the command history, and each command will have a serial number marked in front of it.

10.1.1 Command syntax:
History [Options]

10.1.2 option Parameters

History command option parameter meaning

Option option meaning

-C Purge Command history

-W Let Bash immediately write the history command from memory to the. bash_history file

-A writes the currently added history command to the. bash_history file

n Displays the last n command history, n represents the number

-R reads the contents of the history file and takes them as the current history

10.1.2 Call History Command

Example 1, listing all history records in memory

[Email protected]~] #history
# front omitted
1017 Man Bash
1018 LL
1019 History
1020 History

The information listed is divided into two columns, the first column is the code of the command in this shell, and the other is the contents of the command itself! As to how many command records will be displayed, it is related to Histsize!

Example 2, listing the most recent 3 data

[[email protected]localhost~] #history 3
1019 History
1020 History
1021 History 3

Example 3, immediately write the current data to Histfile

[[email protected]localhost~] #history-W
# in the default case, the history will be written to ~/.bash_history!
[[email protected]localhost~] #echo $HISTSIZE
1000

"Linux command in detail" 10, View History command-[historical]

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.