Changing your default editor on Linux

Changing your default editor on Linux

I find the keyboard shortcuts on VIM very difficult to grasp, and much prefer to use nano as my editor of choice from the Linux command line. Some commands however will automatically use the "default" editor on your system when invoked. For example the crontab edit command:

crontab -e

...will automatically open your crontab with your default editor, and by default on my system (Fedora) it is VIM. To change this to something else, you will need to open your bash profile in your home directory like so:

nano ~/.bashrc

Now add in the following line to the end of that file:

export EDITOR=nano

Note that you can use whatever editor you like here, I just like nano :-) Also note that this change will not take effect until you restart your shell session.

John Collins

I have been writing about web technology and software development since 2001. I am the developer of the Alpha Framework for PHP. I love open source, technology, and economics. You can follow updates from this blog on Twitter.

Installing Ansible on Linux

Rotating Nginx log files via Cron