Command history in emacs shell mode Command history in emacs shell mode bash bash

Command history in emacs shell mode


M-p (and M-n for the other direction) will do the trick.

Here is the link to the Emacs manual on the subject.


Add this to your ~/.emacs:

(define-key comint-mode-map (kbd "<up>") 'comint-previous-input)(define-key comint-mode-map (kbd "<down>") 'comint-next-input)


C-p and C-n and C-r work in (vanilla) bash too, along with some other emacs keys. Very handy.