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?


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. – Riccardo Murri Jun 21 '11 at 10:29
  • ^This (what riccardo said) – meshfields May 8 '14 at 16:55

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 Jun 21 '11 at 20:29

Starting emacs with emacs -nw should do the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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