25

I know of at least four possibilities:

  • eshell
  • term
  • ansi-term
  • shell

What's the complete list of tools built-in to emacs to launch a shell, and what benefits and drawbacks do they offer?

  • 1
    this is an interesting example of a big-list question. It seems that some people on the site (including the two of us) like this sort of question, whereas others really don't. The results can be really variable depending on moderator response. I've started a discussion on meta about it, referencing this question as an example meta.emacs.stackexchange.com/questions/305/… – Joe Corneli Jun 16 '15 at 13:06
31

M-x shell is the standard interface to OS's shell. On linux, it calls bash (or whatever your default), on Windows, it calls cmd.exe. M-x shell is the most frequently used.

M-x eshell is a shell written in emacs lisp entirely. It has a syntax similar to bash, but is integrated with elisp well. e.g. you can eval elisp code right there. Eshell is especially useful on Windows when you don't have cygwin etc installed.

M-x term and M-x ansi-term are terminal emulations, much like gnome-terminal, xterm, etc. The main difference to M-x shell is that, in eshell or shell, keys are still emacs keys, but in term, emacs keys doesn't work. But, the advantage is that you can run ssh, vim, or any command that are text-UI based, which won't work in M-x eshell or M-x shell.

term and ansi-term used to be different packages, but now they are 2 different commands in the same file term.el. I haven't used them much. You can find a more detailed answer about this on emacs wiki.

There is some more information on my blog.

  • 1
    "now are 2 different commands the same file". There may be a missing word or two there. – Faheem Mitha Sep 25 '14 at 13:23
  • 2
    Good answer. A link to the wiki page mentioned would be nice too. – Malabarba Sep 25 '14 at 13:33
  • 3
    "M-x shell is the most frequently used"--I'd want a citation or some data to support that, since I'm not at all convinced that it's true. Also, it adds nothing substantive to the answer. Good answer otherwise. – shosti Sep 25 '14 at 18:27
  • 2
    shosti, i don't have hard statistics. according to the file header, shell is 1988. eshell is 1999. term.el is also 1988. eshell is mostly used by elisp hackers, so that's much fewer than emacs users. That leaves shell vs term. I think we can compare their mention in emacs books, e.g. the 3 or so old ones from O'Reilly. Or Google comparison... but just from experience hanging around in emacs community, i think term/ansi-term is much less used. – Xah Lee Sep 25 '14 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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