crontab -e 下输入任务怎么保存不了,好像不是vi编辑器模式下啊

图片描述

好像不是vi编辑器模式,如何切过去呢,现在Esc+wq都不管用

阅读 4.3k
2 个回答

你说不是就不是喽

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 automatically. If neither of the environment variables is defined, then the default editor /usr/bin/editor is used.

在我的机器上的结果是

$ ls -al /usr/bin/editor

lrwxrwxrwx 1 root root 24 11月 25  2014 /usr/bin/editor -> /etc/alternatives/editor

$ ls -al /etc/alternatives/editor

lrwxrwxrwx 1 root root 16 1月  21  2016 /etc/alternatives/editor -> /usr/bin/emacs24

所以我机器上用的是emacs, 看看你的机器上是什么就知道了.


用`$ sudo update-alternatives --list editor` 查看本机器究竟有哪些editors,
/bin/ed
/bin/nano
/usr/bin/emacs24
/usr/bin/mcedit
/usr/bin/vim.basic
/usr/bin/vim.tiny

然后用sudo update-alternatives --set editor设置成你喜欢的.

看一下你是不是搞了输入法,ESC不排除键盘问题,多按几次,左下角会有提示的。如果不是INSERT证明进入命令模式了,按:wq

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题