When using many utilities in Ubuntu Linux, a default text editor is used to allow you to edit configuration options and files. An example of this is using the crontab command. When you run the command to edit cron jobs, the default editor is opened.

It’s easy to change the default text editor using the update-alternatives command. Select Accessories | Terminal from the Applications menu to open a terminal window.

Opening a terminal window

Enter the following command at the command line:

$ sudo update-alternatives –config editor

NOTE: There are two regular dashes before config in the above command.

A list displays the editors available to be the default editor. The list you see may be different depending on which editors are installed on your system. We decided to select vim as our default editor, so we typed 0 at the prompt and pressed Enter.

Selecting a new default editor

Test our your selection by typing crontab –e at the command line to edit your cron file.

Entering crontab command

The crontab file is opened in vim. To exit vim without saving your changes, type :q! and press Enter.

Editing crontab file in vim

We have previously written about both crontab and vim. See the following posts for more information:

by Lori Kaufman