How do I download the command-line emacs instead of the GUI one?
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?
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
then
apt-cache show <whateverpackage>
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
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
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.
You already have installed it.
Just run emacs with:
emacs -nw