Nano as Default Editor in 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
1 |
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
1 |
echo "set nowrap" >>/etc/nanorc |
Let's continue steps to set Nano as Default Editor in CentOS 7
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.
1 2 3 4 |
cat <>/etc/profile.d/nano.sh export VISUAL="nano" export EDITOR="nano" EOF |
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.
1 2 3 4 |
cat <>~/.bash_profile export VISUAL="nano" export EDITOR="nano" EOF |
Check if you have set Nano as Default Editor in CentOS 7
Try
Try by opening crontab. execute commnad below
1 |
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