kvz.io
Published on

Change the Default Editor

Authors
  • avatar
    Name
    Kevin van Zonneveld
    Twitter
    @kvz

Ever wanted to change the crontab of a server, but got an editor on screen that you're totally unfamiliar with? There are a lot of causes for this annoyance, but one is that somebody recently installed or used midnight commander (mc) which for whatever reason seems to override your session's default editor.

Changing the Editor

The first time it took me a while to figure it out so I thought lets make it an article on my site, so maybe it will help others save some time.

Anyhow, here how to change it, just open your terminal and type

$ export EDITOR="vim"

vim can be vim, nano, or another text editor of your choice of course.

Make It Permanent

If the problem persists, you might want to add the export to your .bashrc file, or even to the /etc/profile file. But that seems a bit radical since that's system-wide :)

Debian / Ubuntu

As noted by Roland in the comments, on Debian / Ubuntu you can use:

$ sudo update-alternatives --config editor

Much better!

Legacy Comments (6)

These comments were imported from the previous blog system (Disqus).

Roland
Roland·

on Debian orUbuntu you can use:
sudo update-alternatives --config editor

Kev van Zonneveld
Kev van Zonneveld·

@ Roland: Didn\'t know that, only used it for java so far. Thanks Roland!

jonw
jonw·

Thanks for that tip... Worked perfectly.

Buddhika
Buddhika·

Thank a lot that is very usefull

Ashish Sood
Ashish Sood·

Usefull topic
thanks Alot

neeraj
neeraj·

I have gone through your site and find that
You are simply a great person....
Good Work and keeping posting ...

God Bless U :)

--neeraj