How do I make gedit the default editor for crontab?

So far I've tried:

sudo update-alternatives --install /usr/bin/gnome-text-editor gnome-text-editor /usr/bin/gedit 100


sudo update-alternatives --install /usr/bin/editor editor /usr/bin/gedit 100

No luck so far. (maybe I just need to reboot?)


Open .profile file using your desired editor:

gedit ~/.profile

Add this line to the file and save it:

export EDITOR=gedit

Logout and re-login. Now when you use crontab -e it would open gedit.

Remember that it's going to set gedit as default editors for other commands too, if you want it to only affect crontab, then you can create an alias:

alias crontab='EDITOR=gedit crontab'
  • For extra credit any idea why the other methods (mentioned above) didn't work? – J Rosenberg Sep 14 '18 at 6:23
  • Because crontab opens the config files using editor defined in EDITOR variable... like most of the other commands. – Ravexina Sep 14 '18 at 6:26
  • 2
    You may want to use the ubuntu/debian program sensible-editor, which chooses a graphical / terminal text editor configured in /etc/alternatives depending on if you are in a X11 session or not. – allo Sep 14 '18 at 11:37

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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