4 ms·
My favorite thing I wish they'd told me about emacs: M-x shell Run a shell (or shells) inside emacs. Great for long running apps like servers. You can search
by pivo 11y ago
My favorite thing I wish they'd told me about emacs:
M-x shell
Run a shell (or shells) inside emacs. Great for long running apps like servers. You can search back through the output using normal Emacs search commands. For me, one of the killer features of Emacs.
Rename the shell buffer to something else to start another shell.
- SamReidHughes 11y agoI had a coworker that'd cringe every time I used it because I used that shell instead of one of Emacs's other shell modes.
- pivo 11y agoIt all depends on what you're doing in a shell. For me, shell is preferable precisely because it's not a full fledged terminal. Meaning regular emacs commands work with it.
- syadegari 11y agoFor more than one shell buffer you can also do C-u M-x shell and then press enter (for the default buffer name) if you can live with shell-2, shell-3, etc. for your shell buffers' names. Saves the time for renaming.
- S4M 11y agoYou don't need to rename it. When you want to start a new shell, go C-u M-x shell and it will ask you how to name the new shell you just created, with default being shell<2>.
- jlindstrom 11y agoSee also: M-x ansi-term
- clocksld 11y agoJust curious, why do you prefer shell instead of term or ansi-term? Both of those other modes have better support for curses applications and act closer to an actual terminal emulator than M-x shell does. Also, if you like term, you can use the "multi-term" script (http://www.emacswiki.org/emacs/multi-term.el http://www.emacswiki.org/emacs/multi-term.el), which will automatically open a new terminal window with M-x multi-term, and you can cycle through your open terminals with M-x multi-term-next and multi-term-prev
- swhipple 11y agoNot the parent, but I also prefer shell to ansi-term for my daily usage. My 99% use-case is running programs that don't need terminal emulator support, but I do commonly use Emacs keybindings for navigating around the buffer -- which requires switching between char and line modes when using ansi-term.
- clynbech 11y agoIt does not need to be either/or. I have configured the terminal mode of ansi-term to allow the cursor keys to move around in the buffer as usual exactly because I often like to back up a bit to look at some output and keeping remembering that the normal buffer movement keys was not available became annoying.
- pivo 11y agoBasically what swhipple says. I work on long running servers and it's fantastic to run them in a shell terminal and be able to use emacs' incremental search to look through the server output for interesting log output. I have no need for curses support generally, but when I do I use a different shell, though I can't say I find them nearly as useful.
- clynbech 11y agoI found that 'shell' mode occasionally got confused, for instance on what the current directory is. I have changed to 'eshell' as my primary shell emulator, one that implements a number of the basic commands directly in elisp. It works quite well, except when running an interactive command which is does not handle well and there are some issues with piping as well.
- pivo 11y agoYes, that is irritating though you can run M-x shell-resync-dirs to fix shell when it gets confused. Generally I like to have bash available so that's why I use shell instead of shell.