Vi si dwarf are editors for Linux. Be it Ubuntu or RedHat, CentOSThese editors are vital when it comes to modify a script, a crontab or any other file present on the Linux operating system. I am kind and nano Notepad for Linux, with the difference that they do not have a graphical interface. They open directly via the command line and are edited with their help in the terminal / console or authenticated on Linux through a client with support SSH, Like Putty or OS X Terminal.
For many users, Vi is a little more complicated, with a set of editing commands which rely on typing more effective than the controls shortcutas in the nano. For example, if we want to close an open file with "vi", we must type the command:: Quit!"Or shorter"Q!", While for" nano "the key combination is enough"Ctrl+ X ". From this point of view, the nano is a little closer to Windows and interface OS X.
If you have installed a Linux operating system, on which "vi" text editor is set default, then you will need to follow a few steps to change the deault text editor from "vi" to "nano".
How to change the text editor default "Vi" in "nano" on CentOS
First, make sure you have the "nano" editor installed on your system. Log in to the system and in the terminal execute the command:
yum install nano
If you already installed the final message you will receive the latest version is already installed on your system
Ex. Package nano-2.0.9-7.el6.x86_64 already installed and latest version / Nothing to do
After "nano" has been installed, use this program to edit the file:/ Etc / bashrc"
nano / etc / bashrc
In the / etc / bashrc file add at the end the line "export EDITOR =" nano ""
export EDITOR = ”nano”
Ctrl + X (y) and save the changes. Log out of the system and log back in to test if the text editor default has been changed.
This tutorial is particularly useful for editing commands that execute without specifying what editor will be used for the file. The best example is editing crontab swaps, which is done by the command: crontab -e. Executing this command will open the cron job file in the set editor default on the system.
In the scenario where vi editor is set default on the system and you don't want to change it, but you want the crontab file to open nanoThen execute the following command in the terminal:
EDITOR = nano crontab -e env
Fiser crontab will automatically open and can be edited with nano for the current session.
Change Linux default text editor software via command line - Linux Tutorials & Tips.