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