Linux – Change default crontab editor to nano in FreeBSD

cronfreebsdlinuxvi

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

Best Answer

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.