10

When I edit the crontab using crontab -e it opens the crontab in vi. I'd prefer it to use nano. How can I change this?

EDIT:

For some reason the export command returns command not found. And changing the EDITOR env value didn't work for crontab -e.

The following command worked on my system:

setenv VISUAL /usr/local/bin/nano

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
Ian
  • 1,488
  • 4
  • 26
  • 32

4 Answers4

14

For sh based shells:

export EDITOR=/path/to/nano

For C shell based:

setenv EDITOR /path/to/nano

Remember that unless you save these setting to your login profile script (/home/user/.bash_profile for example), you lose the setting at log out.

If I remember correctly, FreeBSD uses C shell as the default user shell.

David
  • 3,519
  • 21
  • 17
  • 1
    As a note, csh uses ~/.cshrc for the profile script, so you'd need to put the setenv command in there. – hark Jun 04 '09 at 17:33
1

Should be

export EDITOR=/usr/bin/nano

adjust for your location of nano (use 'which' to find). You can put that command in your .bashrc or similar profile script to have it in effect all the time.

Kevin Kuphal
  • 9,064
  • 1
  • 34
  • 41
-1

Probably by setting the environment variable EDITOR.

I.e.

export EDITOR=/path/to/nano
Ulf Lindback
  • 101
  • 1
  • 3
-3

There is a symbolic link under /etc/alternatives/editor that can be pointed to /path/to/nano

You can use the update-alternatives utility to do this as well - although I am not too familiar with using it.

(note - I'm speaking from an 'ubuntu' point-of-view. not sure if this is the same for FreeBSD)

Brent
  • 22,219
  • 19
  • 68
  • 102