Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking to switch to Emacs from Vim and one thing that is keeping me away is that Emacs opens up a separate window of its own when run under X. Can I get the same behavior for Emacs as it does when not run under X? That is, I want Emacs to start the session in the same terminal as the one in which its fired.

Let me know if the question is not clear. Thank in advance!

share|improve this question

migrated from Dec 3 '09 at 12:01

This question came from our site for professional and enthusiast programmers.

up vote 28 down vote accepted

I'm no emacs expert, but this did the trick for me:

emacs -nw
share|improve this answer
You're right, for the curious -nw is short for --no-window-system which tells emacs not to use its X interface. – Mic Dec 3 '09 at 10:46
Great! Thank You. – Amit Dec 3 '09 at 10:46
@Mic: Thanks for the explanation, this way I'll remember what it stands for – Alberto Zaccagni Dec 3 '09 at 10:47

You might prefer starting emacs as emacs --daemon and then using emacsclient -t to edit files. This keeps Emacs loaded in the background, so that you can use Emacs more like vi. Editing sessions will start up instantly, and "quitting" via C-x C-c will just close the current connection. It is very nice.

share|improve this answer
Did not know about that, thanks – Alberto Zaccagni Dec 3 '09 at 12:01
Thanks. just a note: this is available with Emacs 23+ – Amit Saha Dec 3 '09 at 14:13

Although your question has been answered, I would venture to say that this is not the way any regular user would use emacs. Unlike vim, emacs generally has a longer startup time and anyway tends to be running all the time with multiple open buffers. So when you want to do something with emacs in a terminal, you invoke emacsclient -nw (assuming an emacs serverhas been started). Look at How to start to use EmacsClient for details.

share|improve this answer

If you use bash, you can always add the following to your .bashrc

alias emacs="emacs -nw"

That's saved me a lot of typing (and cursing when I forget to type the switches).

share|improve this answer

Combining the above answers by Dick Kenny and Alberto Zaccagni you get the following configuration which I use in .bashrc:

alias emacs='emacsclient -nw -c -a ""'

This will try to connect to a runnning emacs daemon. If none is running, it will startup a new one, and then connect using the current terminal window.

From the docs:

-a EDITOR, --alternate-editor=EDITOR
        Editor to fallback to if the server is not running
        If EDITOR is the empty string, start Emacs in daemon
        mode and try connecting again

-nw, -t, --tty      Open a new Emacs frame on the current terminal

-c, --create-frame  Create a new frame instead of trying to 
                    use the current Emacs frame
share|improve this answer
When I try this command, Emacs fails to start, instead giving me a warning about there not being a server to connect to, followed by a giant dump of values and Emacs not starting. – Koz Ross Apr 7 at 10:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.