History commands in CentOS: history

Source: Internet
Author: User

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

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.