Emacs has commands for passing single command lines to shell subprocesses, and for running a shell interactively with input and output to an Emacs buffer, and for running a shell in a terminal emulator window.
Run the shell command cmd and display the output
(shell-command
).
Run the shell command cmd with region contents as input;
optionally replace the region with the output
(shell-command-on-region
).
Run the shell command cmd asynchronously, and display the output
(async-shell-command
).
Run a subshell with input and output through an Emacs buffer. You can then give commands interactively.
Run a subshell with input and output through an Emacs buffer. You can then give commands interactively. Full terminal emulation is available.
Whenever you specify a relative file name for an executable program
(either in the cmd argument to one of the above commands, or in
other contexts), Emacs searches for the program in the directories
specified by the variable exec-path
. The value of this
variable must be a list of directories; the default value is
initialized from the environment variable PATH
when Emacs is
started (see General Variables).
M-x eshell invokes a shell implemented entirely in Emacs. It is documented in its own manual. See Eshell in Eshell: The Emacs Shell.