Skip to content

Bash

Bash

Bang Commands

Replace the command but use the same arguments:

>>> echo a b c d e f
a b c d e f
>>> echo !*
echo a b c d e f
a b c d e f

Run the command in line 54 of the Bash History:

!54

Run the last command with a find and replace:

>>> echo aaa
aaa
>>> ^aaa^bbb
echo bbb
bbb

Run the last command with a find and replace all:

>>> echo aaaaaaaaa
aaaaaaaaa
>>> !!:gs/aaa/bbb/
echo bbbbbbbbb
bbbbbbbbb