修改debian中crontab默认编辑器nano为vi
时间:2014-12-12 01:40 来源:linux.it.net.cn 作者:IT
晚上回到家中发现我开发板的时间居然提前了一天,马上安装ntp来同步了时间,为了保证开发板时间上的准确,决定再加到crontab中,让其定时更新下时间,没想到crontab -e之后居然是我没有见过的编辑器,网上搜了下才发现原来debian中crontab默认使用的nano编辑器,好吧,又搜了下怎么退出nano编辑器,原来是使用ctrl+x,然后根据提示来操作,好了,为了方便自己,我决定把nano改成vi.
系统:debian 7
1.修改nano为vi
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.
可能每个人的不一样,因为另外一个朋友执行这条命令的时候,说只有5个选项,反正大家自己看清楚了再选,这里我输入的是8,把crontab默认编辑器改成了vi.
ps:如果没有切换成功,请自己手动重启下cron服务:/etc/init.d/cron restart
2.进行验证
现在输入crontab -e就使用的vi编辑器了.
(责任编辑:IT)
晚上回到家中发现我开发板的时间居然提前了一天,马上安装ntp来同步了时间,为了保证开发板时间上的准确,决定再加到crontab中,让其定时更新下时间,没想到crontab -e之后居然是我没有见过的编辑器,网上搜了下才发现原来debian中crontab默认使用的nano编辑器,好吧,又搜了下怎么退出nano编辑器,原来是使用ctrl+x,然后根据提示来操作,好了,为了方便自己,我决定把nano改成vi. 系统:debian 7 1.修改nano为vi 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. 可能每个人的不一样,因为另外一个朋友执行这条命令的时候,说只有5个选项,反正大家自己看清楚了再选,这里我输入的是8,把crontab默认编辑器改成了vi. ps:如果没有切换成功,请自己手动重启下cron服务:/etc/init.d/cron restart 2.进行验证 现在输入crontab -e就使用的vi编辑器了. (责任编辑:IT) |