Page 1 of 1

Replacing vi with nano - permanently

Posted: 03 Feb 2014, 12:24
by viking60
Many people prefer to have nano as the default terminal editor. On most cases we simply specify nano as the editor so it does not matter.
But when working with cron jobs you will be put into the vi - environment if you do a simple:

Code: Select all

crontab -e

To make sure it opens with nano you can simply put this in your ~/.bashrc

Code: Select all

export EDITOR=nano


Reboot or type:

Code: Select all

source .bashrc

and type crontab -e again; this time it will be opened in nano. :tux5:

Re: Replacing vi with nano - permanently

Posted: 03 Feb 2014, 14:07
by jkerr82508
I always add it to /root/.bashrc as well as ~/.bashrc since I have some cron jobs that need to run as root. Doing so also means that visudo uses nano, rather than vi.

I also always add to both:

Code: Select all

export VISUAL=nano
To be quite honest, I've forgotten why I do the latter. :?:

Jim

Re: Replacing vi with nano - permanently

Posted: 03 Feb 2014, 16:56
by viking60
Good tip there Jim.
It might well come in handy to do a cronjob to backup /etc and then you need to be root. +1
So yes a:

Code: Select all

su
password
nano .bashrc

and putting

Code: Select all

export EDITOR=nano

in there, makes a lot of sense.

Regarding

Code: Select all

export VISUAL=nano
I have seen people refer to it and use it - but I cannot see why either :confused

Even visudo will open in nano after vi have fixed the root .bashrc afaict

Re: Replacing vi with nano - permanently

Posted: 04 Feb 2014, 12:20
by jemadux
i dont like vi ..but i prefer vim ..
sometimes i am using nano for specifics files ..
on my archlinux machine I have removed vi and i made a syblick to vim

Code: Select all

ln -s /bin/vim /bin/vi