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 Vim 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.

5 Answers 5


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

emacs -nw
  • 8
    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, 2009 at 10:46
  • @Mic: Thanks for the explanation, this way I'll remember what it stands for Dec 3, 2009 at 10:47
  • Also, package emacs-nox, present in all common distributions, when installed instead of default emacs-gtk, contains Emacs build without X11 support.
    – dess
    Mar 14, 2021 at 6:25

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.


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.


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
  • 1
    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, 2016 at 10:23

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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .