Emacs & Bash


Running Emacs you frequently need to execute commands or run command line process that would be more suited to an XTerm or similar terminal emulator.

Its a pain to move hands off keyboard and fumble with the mouse when all you need is a quick, 'grep', 'find', 'rename', or 'mv'. Its way simpler to stay in Emacs and hit the command line.

Inside Emacs, you have a few options. You can run the 'shell', 'eshell', or if your used to the XTerm and want full Bash functionality, you can use the 'term'.

Running a terminal in Emacs buffer has many benefits. You can switch between buffers/term as you normally would. You get all the functionality of an XTerm, prompt, color highlight, and so on.

To launch a 'shell' inside an Emacs buffer:

M-x shell

To launch 'eshell' in an Emacs buffer:

M-x eshell

To launch an 'XTerm in an Emacs buffer:

M-x term

Emacs will quiz you if you want '/bin/bash/'. Hit [return] for yes.

One point to note. Normally you hit C-x or M-x to run commands in Emacs. When you run an XTerm session C-x does not work. You need to hit C-c first before executing your command.

For example, to visit a file or open a new file, you hit C-x C-f. In an XTerm buffer, C-x C-f does not open a file. You hit C-c C-f.

Effectively C-c replaces C-x. Mess around, you'll get the hang of it.