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 through the command line and edit with their help in the terminal / console or log 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 it is at nano. By way of example, if we want to close an open file with "vi", we have to 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 installed Linux operating system, which is set to "vi" text editor default, then you need to follow a few steps to change the text editor deault of "you" in "nano".
How do I change the default editor "vi" to "nano" on CentOS
First make sure that you have the editor "nano" installed on your system. Login on terminal server and 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 being installed "nano" use this program to edit the file "/ Etc / bashrc”
nano / etc / bashrc
In the / etc / bashrc file add the line "export EDITOR =" nano ""
export EDITOR = "nano"
Ctrl + X (y) and save changes. Log out of the system and log back on to test whether the default text editor 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 file in the editor cron job sites set on the system default.
In the scenario where vi editor It sets default system and do not want to change it, but you want to crontab file 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 default Linux via command line text editor software - Linux Tutorials & Tips.