How to specify nano or vim as editor for crontab

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  

I always had trouble using vi editor. It did not bother me much as I could use nano editor conveniently.


The situation changed when I had to use crontab for my website and it became kind of mandatory to use vi editor.

I found a decent solution to change the default vi editor for crontab to nano and am sharing the commands below :

You need to use VISUAL environment variable.

Export the value of VISUAL and then run crontab -e command.

Specify nano as the editor for crontab file

export VISUAL=nano; crontab -e

Specify vim as the editor for crontab file

export VISUAL=vim; crontab -e

NOTE : You should have nano or vim editor installed on your system to use them.


Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Leave a Reply

Your email address will not be published. Required fields are marked *