We are Vim editor fans. Vim editor is the most popular editor for UNIX / Linux platform, followed by emacs editor. If you talk to emacs editor fans, they might think otherwise.
In the spirit of learning, we’ve decided to explore emacs editor in detail and we’ll be posting several emacs articles in the upcoming weeks.
In this article, let us review how to install Emacs editor on Ubuntu / Debian. We’ll also see how to do the basic operation of opening and saving a file in Emacs editor.
1. Installing emacs Editor on Ubuntu / Debian
$ sudo apt-get install emacs
Check the version of installed emacs editor as shown below.
$ emacs --version GNU Emacs 22.2.1 Copyright (C) 2008 Free Software Foundation, Inc. GNU Emacs comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of Emacs under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING.
2. Launch emacs Editor in GUI Mode
Type emacs at the command line to open the emacs GUI editor.
$ emacs testfile
You can save and close the file using the menus available.
3. Launch emacs Editor in Text Mode
By default emacs will open in the GUI mode. Use -nw option ( no window ), to open emacs editor in text mode as shown below.
$ emacs -nw testfile
Save File and Exit Emacs Editor
If you are new to emacs editor, following are two things you should know.
- Save the file using CTRL-X CTRL-S
- Exit the editor using CTRL-X CTRL-C