How to set “nano” editor text default, in locul “vim” or another editor

If you are a novice linux user, the most handy text editor is definitely “nano”. In this tutorial you will learn how to set “nano” editor text default, in locul “vim” or another publisher.

Vim and nano I am Text editor for Linux. Whether we are talking about Ubuntu or of RedHat, CentOS, these editors are vital when it comes to We change a script, and crontab or any other file present on the operating system Linux.

Vim (more advanced version of “vi“) and nano I'm a kind of Notepad for Linux, with the difference that they do not have a graphic interface. They open directly through the order line and edited with their help in the terminal / console or authenticated on Linux by a client with support SSH, gen Putty or Terminal (macOS).

For many users, vim is something more complicated, having a edit set which are based more on the actual typing of orders than on shortcut-uri, as it is at nano. Of extemple, if we want to close an open file with “vi“, we must type the order: “:quit!” or shorter “:q!“, while at “nano” It is enough the combination of keys “Ctrl+X“. In this regard, nano is a little closer to Windows and the interface macOS.

If you have a Linux operating system installed, which is set “vi” Text editor default, then you will have to follow some simple steps through which you set “nano” editor text default in Linux.

How to set “nano” editor text default, in locul “vim” or another editor

First of all, make sure you have the editor “nano” installed on the system. Log on the system and in the terminal execute the command:

sudo yum -y install nano

If it is already installed you will receive the message that the latest version is already installed on your system.

Package nano-2.3.1-10.el7.x86_64 already installed and latest version

To set Nano as a default editor CentOS, you must add the next line to the file ~/.bashrc of your user:

export VISUAL=nano

This will make any order that opens an editor to use nano Instead of the default publisher, such as vi or vim.

If you want nano be default for all users, you can add this line to the file /etc/bashrc. After adding this line, you must load the file .bashrc With the command:

source ~/.bashrc

or

source /etc/bashrc

to make the active order.

This tutorial in which you learn how to set “nano” Editor text default, is especially useful for editing orders that execute without specifying which editor will be used for the respective file. The best example is editing crontab-to -order that is done by order: crontab -e. By executing this command, the file will open cronjobto the publisher set default on the system.

In the scenario in which EDITOR vi It is set default to the system and you do not want to change it, but the file crontab You want to Open with nano, then execute the following order in the terminal:

env EDITOR=nano crontab -e

file crontab will open automatically and be able to be edited with nano for the current session.

Passionate about technology, I write with pleasure on stealthsetts.com starting with 2006. I have a rich experience in operating systems: Macos, Windows and Linux, but also in programming languages ​​and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, Presashop).

Home Your source of IT tutorials, useful tips and news. How to set “nano” editor text default, in locul “vim” or another editor
Leave a Comment