Shell Mode Shell Shell Options
Shell buffers support three ways of repeating earlier commands. You
can use the same keys used in the minibuffer; these work much as they do
in the minibuffer, inserting text from prior commands while point
remains always at the end of the buffer. You can move through the
buffer to previous inputs in their original place, then resubmit them or
copy them to the end. Or you can use a `!
'-style history
reference.