Command history and "!" The use

Source: Internet
Author: User

First, the Order history

The shell has the ability to automatically record command history, and commands executed by the user are automatically logged to the. bash_history hidden file in their home directory at logoff.
History can be viewed through the historical command, and all command histories have a record number. The amount of Information the command history can record is determined by the histsize variable, CentOS6 defines histsize=1000 through/etc/profile files, which can record up to 1000 commands that were used most recently, and when a 1001th command executes, The first command is overwritten, and the Execute history-c command clears all history records.

Two, "! "The use of

“!” The role of: "!" You can use the Quick History command

!! Perform the last command
!$ represents the last used path
! + keyword to perform the most recent command associated with a keyword
! + commands for numeric execution numbers

[[Email protected]/]#        !] Executes the last command Ls/home/pzk use1[[email protected]/]#   !108     !ls      // Executes the most recent command associated with a keyword LS/HOME/PZK use1

Command history and "!" The use of

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.