Emacs

Emacs is probably the most powerful text editor in existence. It can do absolutely everything and is infinitely extensible through its built-in lisp-based programming language. With Emacs, you can move around the web, read your mail, take part in Usenet newsgroups, make coffee, and so on. This is not to say that you will learn how to do all of that in this chapter, but you will get a good start with opening Emacs, editing one or more files, saving them and quitting Emacs.
If, after reading this, you wish to learn more about Emacs, you can have a look at this Tutorial Introduction to GNU Emacs
Invoking Emacs is done as follows:
emacs [file] [file...]
Emacs will open every file entered as an argument into a separate buffer, with a maximum of two buffersvisible at a time. If you start Emacs without specifying any files on the command line you will be placed intoa buffer called *scratch*. If you are in X, menus will be available, but in this chapter we will concentrate on working strictly with the keyboard.
Getting Started
It’s now time to get some hands-on experience. For our example, let us start by opening two files, file1 and file2. If these files do not exist, they will be created as soon as you write something in them:
$ emacs file1 file2
By typing that command, the following window will be displayed:
As you can see, one buffer has been created. A third one is also present at the bottom of the screen (where you
see (New file)). That is the mini-buffer. You cannot access this buffer directly. You must be invited by Emacs during interactive entries. To change the current buffer, type Ctrl+x o. You type text just as in a “normal” editor, deleting characters with the DEL or Backspace key.
To move around, you can use the arrow keys, or you could use the following key combinations: Ctrl+a to go to the beginning of the line, Ctrl+e to go to the end of the line, Alt+<> to go to the end of the buffer. There are many other combinations, even ones for each of the arrow keys 2. Once you are ready to save your changes to disk, type Ctrl+x Ctrl+s, or if you want to save the contents ofthe buffer to another file, type Ctrl+x Ctrl+w. Emacs will ask you for the name of the file that the contents of the buffer should be written to. You can use completion to do this.
Copy, Cut, Paste, Search
First off, you will need to select the text you want to copy. In this example we want to copy the entire sentence.The first step is to place a mark at beginning of the area. Assuming the cursor is in the position where it is the command sequence would be Ctrl+ SPACE (Control + space bar). Emacs will display the message Mark set in the mini-buffer. Next, move to the beginning of the line with Ctrl+a. The area selected for copying or cutting is the entire area located between the mark and the cursor’s current position, so in this case it will be the entire line of text. There are two command sequences available: Alt+w (to copy) or Ctrl+w (to cut). If you copy, Emacs will briefly return to the mark position so that you can view the selected area.