GNU Emacs Manual - Shell

Go to the first, previous, next, last section, table of contents.

## 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*'`.

`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.

Go to the first, previous, next, last section, table of contents.