I would like to understand what is the difference between M-x shell and M-x term? Also under which circumstances should be used the first and under which the second?


1 Answer 1


shell is the oldest of the two. It uses Emacs's comint-mode to run a subshell (e.g. bash). In this mode, you're using Emacs to edit a command line. The subprocess doesn't see any input until you press Enter. Emacs is acting like a dumb terminal. It does support color codes, but not things like moving the cursor around, so you can't run curses-based applications.

term is a terminal emulator written in Emacs Lisp. In this mode, the keys you press are sent directly to the subprocess; you're using whatever line editing capabilities the shell presents, not Emacs's. It also allows you to run programs that use advanced terminal capabilities like cursor movement (e.g. you could run nano or less inside Emacs).

This question was originally answered by cjm on the Unix Stack Exchange Site.

  • 1
    From what I read here term should be used instead of shell as it is more advanced, right?
    – Adam
    Oct 28, 2014 at 1:05
  • 1
    It is primarily opinion based, usually the one you work more efficiently in. I personally prefer shell, because of color codes and I am used to it. Oct 28, 2014 at 1:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.