Emacs: Run Shell in Emacs
This page is a tutorial on running
inside Emacs. On Linux, this is usually Bash. On Windows, this is
cmd.exe, or can be PowerShell.
Running Shell in Emacs
How to run a shell inside emacs?
When in shell, to run the previous shell command, press Ctrl+↑.
How to run a second shell inside emacs?
Can i run ssh inside emacs?
term (this will create a new term for each command call). Then, you can run ssh, top, vi, etc. You can even start another emacs.
To exit term, press Ctrl+d.
describe-mode to see full list of its keys.
I do not recommend using term because normal emacs keys won't work. It's confusing to have two key systems in emacs. I using recommend a dedicated terminal to run ssh.
How to call a shell command once?
to run just 1 shell command.
How to send current text selection to a shell command?
Select a region, then Alt+x
For example, select a region, then type Alt+| wc -l Enter. This will print line count of region.
You can have the result replace the selected region. to do that, do Alt+x
universal-argument 【Ctrl+u】 before calling the shell on region command.
Shell on Microsoft Windows
On Windows, by default, when you Alt+x
shell, it starts
How to run PowerShell in emacs?
You need to install the PowerShell mode.
How to have unix shell commands on Windows?
Install chocolatey [https://chocolatey.org/], then install
choco info grep
choco info findutils
Replace the “info” by “install”.
Or try Emacs: xah-find.el, Find Replace in Pure Elisp
My shell doesn't work in Windows?
Most problems are probably caused by incorrect environment variable setup. See: Emacs in Microsoft Windows FAQ.