41 Running Shell Commands from Emacs
Emacs has commands for passing single command lines to inferior shell
processes; it can also run a shell interactively with input and output
to an Emacs buffer named ‘*shell*’ or run a shell inside a terminal
emulator window.
There is a shell implemented entirely in Emacs, documented in a separate
manual. See Eshell.
- M-! cmd <RET>
- Run the shell command line cmd and display the output
(
shell-command
).
- M-| cmd <RET>
- Run the shell command line cmd with region contents as input;
optionally replace the region with the output
(
shell-command-on-region
).
- M-x shell
- Run a subshell with input and output through an Emacs buffer.
You can then give commands interactively.
- M-x term
- Run a subshell with input and output through an Emacs buffer.
You can then give commands interactively.
Full terminal emulation is available.
- M-x eshell
- Start the Emacs shell.