Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can I change the default crontab editor to vi editor? If so, how?

share|improve this question
up vote 2 down vote accepted

Most of the time I do something like:

# env EDITOR=vi crontab -e


# env VISUAL=vi crontab -e
share|improve this answer

From man crontab:

The -e option is used to edit the  current  crontab  using  the  editor
specified  by  the  VISUAL  or EDITOR environment variables.  After you
exit from the editor, the modified crontab will be installed  automatiâ
cally.  If  neither  of  the environment variables is defined, then the
default editor /usr/bin/editor is used.

So configure $VISUAL or $EDITOR to suit your needs.

share|improve this answer
Yup, additionally you can just set the EDITOR variable in your .bashrc, and then that will be set for all future shell sessions. – EEAA Nov 3 '10 at 15:07

setting your env to use vi will only pertain to your user account

to change it system wide for all users, on a debian based distro use this command-

update-alternatives --config editor

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.