【Linux教程】修改crontab默认编辑器为vim

2017-04-241.5万
AI 快速预览详细 收起
本文介绍了如何在Debian系统中将crontab默认编辑器从nano切换为vim。通过运行update-alternatives --config editor命令,用户可以选择vim.tiny作为新的默认编辑器。如果切换不成功,可以手动重启cron服务。这个过程简单且有效,提高了用户的编辑体验。
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

    创作许可协议

    本项目采用 None(不开放任何权利,保留所有权利) 进行许可。

    评论(3)
    iooops
    iooops
    其实我觉得Nano挺好用的呀~
    凌风清羽
    凌风清羽
    作者
    回复iooops
    用过Ctrl+V Shift+i Double Esc你就可以做决定了
    iooops
    iooops
    不是有些程序猿宝宝特别喜欢EMACS……
    pATAq
    pATAq
    www.linuxidc.com
    。。。。。。
    - 没有更多了 -