History commands in CentOS: history

Source: Internet
Author: User
[Root @ linux ~] # History [n] [root @ linux ~] # History [-c] [root @ linux ~] # History [-raw] histfiles parameter: n: number, meaning "list of the last n commands! -C: delete all history content in the current shell.-a: add the newly added history Command to [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.