4.10 Text Editors

Most FreeBSD configuration is done by editing text files. Because of this, it is a good idea to become familiar with a text editor. FreeBSD comes with a few as part of the base system, and many more are available in the Ports Collection.

A simple editor to learn is ee, which stands for easy editor. To start this editor, type ee filename where filename is the name of the file to be edited. Once inside the editor, all of the commands for manipulating the editor's functions are listed at the top of the display. The caret ^ represents Ctrl, so ^e expands to Ctrl+e. To leave ee, press Esc, then choose the “leave editor” option from the main menu. The editor will prompt you to save any changes if the file has been modified.

FreeBSD also comes with more powerful text editors such as vi as part of the base system. Other editors, like editors/emacs and editors/vim, are part of the FreeBSD Ports Collection. These editors offer more functionality at the expense of being a more complicated to learn. Learning a more powerful editor such as vim or Emacs can save more time in the long run.

Many applications which modify files or require typed input will automatically open a text editor. To alter the default editor used, set the EDITOR environment variable as described in the shells section.