I installed Emacs using sudo apt-get install emacs. The problem is that when I launch Emacs from the command line (e.g. emacs main.c) it opens Emacs with a GUI. I prefer the command line version which runs in the terminal emulator.

How can I install (or change some default) so that Emacs will open in the command line instead of a GUI?

3 Answers 3


If you would like to start Emacs in the terminal and without any X11 graphics support, just call it with the -nw command line switch:

emacs -nw #...other options

You can set up a shell alias if you're doing this frequently.

This works also in the cases where you don't have control over what is installed.

  • 2
    Additionally, if the $DISPLAY environment variable is not set, emacs will use the terminal version.
    – KeithB
    Commented Jun 21, 2011 at 20:29

Installing emacs-nox instead of emacs should do the trick.

  • 5
    In Debian/Ubuntu, the "no X" flavor of Emacs has a version number embedded: so the package name is emacs23-nox. Commented Jun 21, 2011 at 10:29
  • ^This (what riccardo said)
    – user46399
    Commented May 8, 2014 at 16:55

Starting emacs with emacs -nw should do the trick.

You must log in to answer this question.