Bash Bang (!) commands(bash的“!”命令,重新运行前一个命令的全部或部分。)

Re-run all or part of a previous command.

Syntax
      !!       Run the last command again

      !foo     Run the most recent command that starts with 'foo' (e.g. !ls)

      !foo:p   Print out the command that !foo would run
               also add it to the command history

      !$       Run the last word of the previous command (same as Alt + .)

      !$:p     Print out the word that !$ would substitute

      !*       Run the previous command except for the last word

      !*:p     Print out the previous command except for the last word

     ^foo^bar  Run the previous command replacing foo with bar

转载自:https://ss64.com/bash/bang.html

原文地址:https://www.cnblogs.com/jacen789/p/13359686.html