Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 used sudo apt-get install emacs to download emacs. I expected the command-line emacs to start when I ran emacs but instead the GUI emacs started.

How can I download the command-line emacs?

share|improve this question
up vote 36 down vote accepted

The command-line emacs is installed along with the GUI.
To run it, use the -nw option. An explanation from man emacs:

-nw, --no-window-system
Tell Emacs not to use its special interface to X. If you use
this switch when invoking Emacs from an xterm(1) window, display
is done in that window.

So run the following command to use emacs from the command-line:

emacs -nw

enter image description here

If you don't want to have to type emacs -nw, you could create an alias. Put the following line in your ~/.bashrc or ~/.bash_aliases:

alias emacs="emacs -nw"

You can add this alias in one line by using I/O Redirection:

echo alias emacs="emacs -nw" >> ~/.bashrc
share|improve this answer
This answer only covers running non-X emacs. This does not explain how to download emacs that is only for command line. – user2943160 May 16 at 11:44

That would be emacs-nox I believe. This is the meta-package that currently points to emacs24-nox .

Description: The GNU Emacs editor (without X support)

So, just as before but with that package:

sudo apt-get install emacs-nox

or alternatively

sudo apt-get install emacs24-nox

For cases like this, where you wonder what's in what package, try this :

apt-cache search ^emacs 


 apt-cache show <whateverpackage>
share|improve this answer
"sudo apt-get install emacs24-nox" did work for me. – Stephan Kristyn Oct 25 '13 at 11:57
Stephan - try emacs23-nox. Its still a big package at 26MB download/78MB on disk. – user207039 Dec 26 '13 at 1:42
This is closer to what I believe the accepted answer should be. Often Emacs is desired on servers which do not need the resource clutter of the full emacs distribution installed. – ctpenrose May 17 '15 at 0:24
Installing nox required 7 dependencies for me on a fresh system. Without nox, it would've installed 122. – agweber Sep 24 '15 at 15:24
It's too bad that this great big thing doesn't include a decent Editor. (Grinning, Running, and Ducking) – Warren P Dec 15 '15 at 21:32

You already have installed it.

Just run emacs with:

emacs -nw
share|improve this answer

I think I accidentally downgraded a post without intending to. emacs -nw is the correct option.

I just get tired of the vi/emacs flame warz. If the original post didn't mention vi, then mentioning vi doesn't help.

Besides, emacs has a vi mode in it - viper-mode.

share|improve this answer

If possible, delete the old version of emacs, then reinstall the version without X. The * on the end of the command is important and will save you from a world of pain.

apt-get remove emacs*
apt-get install emacs-nox

You can also specify the version of emacs without X to install, such as emacs23-nox or emacs24.nox rather than installing the alias package.

Sure, you can mess with bash aliasing or pass in -nw, but when you use sudo, or emacs is summoned by git, you'll see that X window once again.

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.