Emacs: Run Shell in Emacs

By Xah Lee. Date: . Last updated: .

Start Shell in Emacs

Alt+x shell.

emacs bash 2016-07-18
bash shell in emacs. linux.
emacs zsh 2024-07-03 94607
zsh shell in emacs. Mac.

Shell on Microsoft Windows

Start a Second Shell in Emacs

Ctrl+u Alt+x shell

[see Emacs: Universal Argument (prefix arg)]

Call Previous Shell Command

When in shell, to run the previous shell command, press Ctrl+.

Call a shell command once

Alt+x shell-commandAlt+!】 to run a single shell command.

Send text selection to a shell command

Select a region, then Alt+x shell-command-on-regionAlt+|】.

For example, select a region, then type Alt+| wc -l Enter. This will print line count of region.

to have output replace region, call Emacs: Universal Argument (prefix arg).

Shell in Emacs