First time I ran crontab -e it asked me to choose text editor. However I canceled command. When I run it again this is the output:

$ crontab -e
no crontab for root - using an empty one

How do I reset it? How do I make it ask me for text editor again?

I reinstalled (apt-get remove cron && apt-get update && apt-get install cron) cron but the issue is still here.


There are two methods to solve this situation, one which uses a system command, and another more manual method.

Select-editor command

Use the command:


Which will give you another attempt at using the number-based system to select the default text editor.

Manual Method:

If it does not already exist, create the .selected_editor file for the user. This should be located in the user's home directory.

The contents should depend on which editor you prefer, for simplicity I'd recommend nano. To use nano the file should contain the line:


To use the slightly more complicated/feature-rich editor vim, use:


Once you've specified your preferred editor, reload the cron service with:

service cron reload

At which point your user's crontab -e command should work as expected, with the chosen editor.

NOTE:This is the upstart method for restarting a service, which still works on 14.04, though using the systemd method systemctl is recommended for 16.04


Check to see if .selected_editor exists in /root/ if you are logged in as root, /home/$USER directory if you are not logged in as root.

If it does exist, then remove the file with one of the below commands:

  • For root user: rm /root/.selected_editor
  • For non-root user: rm /home/$USER/.selected_editor
  • Neither of these directories contain .selected_editor file. I also used locate .selected_editor command and output was empty. – Kunok Jul 25 '16 at 13:40

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.