Why Run Shell in Emacs
Advantage of Running Shell in Emacs
- You can copy, paste, edit, any part of shell output easily, to/from any buffer.
- You have full power of emacs to edit any line, regex search, or jump into any file path [see Emacs: Open File Path Under Cursor 🚀], or using emacs abbrev system, etc.
- You don't have to leave emacs. No need to switch back and forth between emacs and terminal.
- Shell session is automatically logged (it doesn't scroll off the top). You can save the buffer anytime you want (Alt + x
write-file
), or close it, or run multiple shells, each runs in a buffer. No need to prepare to log a terminal session in advance. [see Linux: Record a Terminal Session, Logging Shell Output]

shell
Disadvantage of Running Shell in Emacs
- Run shell in emacs is slower. For very large compile job that prints lots output, better run in a dedicated terminal. The larger the buffer, the slower emacs becomes. Emacs is not good for handling large files. Compile small software {./configure, make, make install} build is fine. For example, it's perfectly fine to build emacs by running bash inside emacs. But you probably don't want to build linux that way.
- Don't run shell in emacs for large compile jobs. Emacs is pretty stable, but could crash, since there can be many things going on in emacs (email, irc, etc). When you build large software that takes long time by running shell in emacs, and if emacs crashed, it'd be a problem.
- Interactive commands may not work well. (e.g. ssh, complicated git command, apt-get, any tool from programing languages such as python, ruby irb ri gem, js npm, yarn, etc)
- Interactive programs written with Text User Interface does not work. (e.g. vim, top, htop, and any written using ncurses)
Some of the interactive software problems above can be solved by
Alt + x term
. But i don't recommend it because that introduces other complexities. For one thing, your normal emacs keys don't work anymore.
I run common daily unix commands in emacs shell. But for installing something new (For example, ruby/python/js package manager), or some new 3rd party unix command i've never used before, i goto a dedicated terminal app to avoid complexity/confusion.
Run Common Linux Command in Emacs
For common commands, such as ls, cd, mkdir, find, grep, you should do them all in emacs.
I used dired for these.
[see Emacs: File Manager, dired]