Emacs: Difference between shell, term, eshell

By Xah Lee. Date: . Last updated: .

Emacs has many shell commands. Here's their differences:

Alt+x shell
Start the standard emacs interface to Operating System's command line interface. [see Emacs: Run Shell in Emacs]
Alt+x term
Start the terminal emulator in emacs. It behaves like a dedicated terminal app, such as {xterm, gnome-terminal, puTTY}. It is compatible to more shell apps than emacs shell interface, but standard emacs keys such as moving cursor doesn't work here.
Alt+x ansi-term
Pretty much same to term today. They were different packages, but now both defined in term.el
Alt+x eshell
A shell written entirely in emacs lisp. Note: it is not a bash emulator. Eshell is a shell by itself, but similar to bash or other shells. [see Emacs: eshell]
emacs shell 2017 11 01 57491
Alt+x shell and Alt+x eshell and a buffer.

Which should you use?

It depends on your preference and needs. The following is some general guide.

shell is the most popular. It is good for general use of classic/standard unix shell commands, such as {grep, du, ls, sort, cat, head, tail, uname}. [see Linux: Basic Shell Commands]

term and ansi-term are good if you want to run stuff like ssh, or other command line interactive interface (such as {python, ruby, lisp} shell), or text based GUI app such as vim.

eshell is good especially on Microsoft Windows where bash is not installed. Eshell is also super fast on startup. If you are a emacs lisp programer, you might prefer eshell because direct access to emacs lisp and better integration with emacs.

Personally, i used shell from 1998 to 2013, and eshell since 2013. But i always have a real terminal app open, for running any command i'm not familiar with. For any serious command, such as starting a server, or any command that has logs, i run it in a real terminal app, with no tie to emacs.

If you have a question, put $5 at patreon and message me on xah discord.
Or support me by Buy Xah Emacs Tutorial

Emacs Tutorial

Emacs Init

Emacs Keys

ELisp

ELisp Examples

ELisp Write Major Mode


Emacs Tutorial

Quick Start

Manage Windows

File

Buffer

Find Replace

Copy/Paste

Unicode

Whitespace

Rectangle Edit

Line Wrap

Shell

View Special File

Working with Brackets

Org Mode

HTML

Emacs Efficiency

Misc