De man bash
, seção HISTORY EXPANSION
:
Event Designators
An event designator is a reference to a command line entry in the history list. Unless the reference is absolute, events are relative to the current position in the history list.
[...]
!! - Refer to the previous command. This is a synonym for '!-1'
Você pode desativar a expansão do histórico com set +H
se não gostar. Eu geralmente prefiro usar o readline para fazer pesquisas de histórico.