jyriand
jyriand

Reputation: 2534

How to open Emacs inside Bash

I'm using Ubuntu 11.10 (Oneiric Ocelot). When I type the command "emacs" in the terminal, it opens Emacs as a separate window. How can I open it inside the terminal, like the nano editor?

Upvotes: 157

Views: 148022

Answers (8)

user2497
user2497

Reputation: 119

Try emacs —daemon to have Emacs running in the background, and emacsclient to connect to the Emacs server.

It’s not much time overhead saved on modern systems, but it’s a lot better than running several instances of Emacs.

Upvotes: 1

Eric Ihli
Eric Ihli

Reputation: 1907

I didn't like the alias solution for my purposes. For one, it didn't work for setting export EDITOR="emacs -nw".

But you can pass --without-x to configure and then just the regular old Emacs will always open in terminal.

curl http://gnu.mirrors.hoobly.com/emacs/emacs-25.3.tar.xz
tar -xvzf emacs-25.3.tar.xz && cd emacs-25.3
./configure --without-x
make && sudo make install

Upvotes: 5

muhe
muhe

Reputation: 107

emacs hello.c -nw

This is to open a hello.c file using Emacs inside the terminal.

Upvotes: 1

user2820579
user2820579

Reputation: 3461

In the spirit of providing functionality, go to your .profile or .bashrc file located at /home/usr/ and at the bottom add the line:

alias enw='emacs -nw'

Now each time you open a terminal session you just type, for example, enw and you have the Emacs no-window option with three letters :).

Upvotes: 36

speeves
speeves

Reputation: 1376

If you need to open Emacs without X:

emacs -nw

Upvotes: 13

Jeff Foster
Jeff Foster

Reputation: 44746

Emacs takes many launch options. The one that you are looking for is emacs -nw. This will open Emacs inside the terminal disregarding the DISPLAY environment variable even if it is set. The long form of this flag is emacs --no-window-system.

More information about Emacs launch options can be found in the manual.

Upvotes: 261

adolflow
adolflow

Reputation: 49

It can be useful also to add the option --no-desktop to avoid launching several buffers saved.

Upvotes: 0

topskip
topskip

Reputation: 17385

Just type emacs -nw. This won't open an X window.

Upvotes: 55

Related Questions