Debian系统在使用crontab默认的编辑器是nano,用起来很不方便,该如何进行切换呢?

root@debian:~# update-alternatives --config editor
There are 8 choices for the alternative editor (providing /usr/bin/editor).
  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/joe         70        auto mode
* 1            /bin/nano            40        manual mode
  2            /usr/bin/jmacs       50        manual mode
  3            /usr/bin/joe         70        manual mode
  4            /usr/bin/jpico       50        manual mode
  5            /usr/bin/jstar       50        manual mode
  6            /usr/bin/rjoe        25        manual mode
  7            /usr/bin/vim.basic   30        manual mode
  8            /usr/bin/vim.tiny    10        manual mode
Press enter to keep the current choice[*], or type selection number: 8
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/editor (editor) in manual mode.

输入命令之后,提示选择,根据自己喜好进行选择即可,这里我选择的是VI编辑器,输入8。

现在crontab编辑器已经变成了VI。

如果没有切换成功,请手动重启一下服务:/etc/init.d/cron restart