Next: Compiling, debugging, and tags
Up: Highlights of GNU Emacs
Previous: The info browser
The shell
It is possible to run a UNIX shell under Emacs, and this allows any
number of useful effects.
The command M-x shell moves to a buffer named *shell*
running a UNIX shell
(creating it if necessary). Anything typed into this buffer is sent
to the shell, just it would be outside of Emacs. Any output
produced as a result of the commands sent to the shell is placed at
the end of the shell buffer.
Because the
shell is running in an Emacs window, the contents of the shell can be
edited and navigated
freely, and the entire record of the input and output to the
shell is available at all times.
A few keys have slightly different-from-usual meanings in the shell buffer.
- RET
- sends whatever line the cursor is on to the shell and moves
to the end of the shell buffer. Hence, one can repeat a command by
placing the cursor anywhere in it and typing RET.
- TAB
- attempts to complete the immediately preceding file name.
- C-c C-c
- is the same as a single C-c outside Emacs.
- C-c C-d
- is the same as C-d (end-of-file) outside Emacs.
- C-c C-z
- is the same as C-z outside Emacs.
- C-c C-u
- kills the current line of input to the shell.
It is sometimes useful to run a single shell command over
a region of text in a buffer.
- M-|
- prompts for a shell command and executes it,
giving the current region as the standard input. If the M-|
is preceded by C-u, the output of the command replaces the
region. Otherwise, the output goes to a separate buffer.
For example, to sort the lines in the current region, enter the command C-u M-| sort.
Next: Compiling, debugging, and tags
Up: Highlights of GNU Emacs
Previous: The info browser
David Wolfe
1998-12-15