Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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 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?

share|improve this question
up vote 12 down vote accepted

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

share|improve this answer
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) – Stephan Kristyn 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.

share|improve this answer
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.

share|improve this answer

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.