3. Self-learning Linux road: Shell feature three: command history

Source: Internet
Author: User

Command history

Summary: Bash holds a list of commands that have been executed in the past.

The command process for the current shell is saved in memory.

When you exit, save the hidden folder to the current User folder. Bash_histroy, ls-a can view

  

History Shortcuts:

!#: #为命令历史列表中的命令编号 (#history: View the history and number of commands in the cache)

!: Executes the previous one, equivalent to the direction key

!-1: Perform the first countdown command

!string: The last command in the execution history that starts with string

History-c: Emptying the command history in the cache

history-d #: Delete section # command

HISTORY-A: Append to Buffer

  arguments referencing the previous command :

!$ or shortcut ESC release and press.

  

Environment Variables for command history

Histsize:

echo $HISTSIZE: View the value of a variable-"1000

Histfile:

echo $HISTFILE:/root/.bash_history

Histfilesize:

echo $HISTFILESIZE: 1000

Histcontrol: Controlling the generation of command history

Echo $HISTCONTROL

1. Ignoredups: Ignore consecutive and repetitive commands

2. Ignorespace: The command to start the space is ignored

3. Ignoreboth: Merging on two functions

To modify the value of the Histcontrol, just run the assignment statement.

  

    

3. Self-learning Linux road: Shell feature three: command history

Related Article

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.