Emacs: Run Shell in Emacs
Start Shell in Emacs
When in shell, to run the previous shell command, press Ctrl+↑.
Start a Second Shell in Emacs
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.
Call a shell command once
to run just 1 shell command.
Send 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
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?
shell, then type
eshell, then type
Or, 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: Find Replace in Pure Elisp, xah-find.el
My shell doesn't work in Windows?
Most problems are probably caused by incorrect environment variable setup. See: Emacs in Microsoft Windows FAQ.