CSC373/406: linux: Unix text editors [27/42] Previous pageContentsNext page

To edit your programs, you will need a text editor.

nano is the easiest to use.

Having said that, the most popular editors in UNIX/Linux are vim and emacs. You can learn about vi at

and emacs at

Here is a short primer on emacs. To start emacs type


To open a file file.c using emacs, type

$emacs file.c

You can start editing know. When you want to save your file, type

Ctrl-X Ctrl-S (This means pressing the Ctrl key and pressing x and then s, while still pressing the Ctrl key)

To save a file under a different name, type

Ctrl-X Ctrl-W

To exit emacs, type

Ctrl-X Ctrl-C

Here is a short list of important emacs editing commands

To move the cursor forward or backward, type

Ctrl-F or Ctrl-B

respectively.To move the cursor up or down, type

Ctrl-P and Ctrl-N

respectively. To delete a character pointed to by the cursor, type


To cut and paste, move the cursor to the first character of the part you want to cut and paste. Then type

Ctrl-SPACE (SPACE is the space bar)

Then move the cursor down to the last character of the part you want to cut. Then type


to cut the text. You can then move the cursor to the position where you want to paste, and type


to paste. You can paste the cut text again and again with Ctrl-Y.

You should be able to modify the properties of the VT102 terminal emulator in SSH to customize some of teh key bindings.

For additional info about UNIX/Linux go to Norman Matloff's intro to Unix

Previous pageContentsNext page