Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers 3

up vote 2 down vote accepted

Most of the time I do something like:

# env EDITOR=vi crontab -e

or

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

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
3  
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
add comment

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
add comment

Your Answer

 
discard

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.