fc
processes the command history list. fc
$EDITOR
and lets one write a (possibly complex) shell command. After saving and closing the editor, that command is executed. Alternatively, <Esc>v
can be used (provided set -o vi
is used) esc
followed by v
also opens the editor. It has the advantage that the currently typed (but not executed) command is taken into the editor for further processing