How to Set Nano as Default Editor on CentOS 7

How to Set Default Editor to Nano on CentOS 7 – Not everyone is familiar with the “vim” text editor. Its many shortcuts are also not easy to memorize. One of the most commonly used text editors is nano, but in the CentOS 7 standard installation, nano is not yet a standard text editor. Therefore, follow the steps below to make nano as a standard text editor, so that it will be easier for us to do editing, for example, to edit crontab

Install nano

Execute command below to install nano

yum -y install nano

Disable Word Wrap

Nano by default enables word wrap. While nice in a normal document, this is generally undesirable in a configuration file

echo "set nowrap" >>/etc/nanorc

Set System Default Editor

During login, a number of scripts are run to setup the environment. In CentOS, a file for each subject is used. These are stored in a system profile directory, /etc/profile.d/. There are two environment variables that control which editor to use.

cat <>/etc/profile.d/nano.sh
export VISUAL="nano"
export EDITOR="nano"

Set Per User Default

If a user wishes to set the default editor for themselves, it can be, instead, be done in the user’s bash profile.

cat <>~/.bash_profile
export VISUAL="nano"
export EDITOR="nano"


Try by opening crontab. execute commnad below

crontab -e

If it opened in nano, so, those steps is right..Try to logout and then login again if still fail

Thats is steps to Set Nano as Default Editor on CentOS 7, if you want to install Percona on Centos 7, please follow this link

Tags : editorlinuxsetting

Leave a Response

We would like to show you notifications for the latest news and updates.
Allow Notifications