Nano is one of the editors frequently used in the Linux operating system alongside Vi/Vim. If you want to try using Nano, or are used to using Nano but it is not available in the Linux distribution you are currently using, you can follow this tutorial on how to install Nano on CentOS 7.
Although titled how to install Nano on CentOS 7, this method can actually also be used on other Linux distributions based on Red Hat Enterprise Linux (RHEL) such as Fedora, Rocky Linux, and Oracle Linux.
How to Install Nano on CentOS 7
Before continuing, make sure you can log in to your server via SSH first, whether using Terminal, CMD, or an SSH application like PuTTY.
Additionally, you can check whether nano is already installed or not by trying to use the nano command
nanoIf nano is not yet installed, you will get a “nano: command not found” message and can proceed to the process of installing the nano editor
1. Install Nano
Depending on the package manager used, you can use the command yum or you can also use dnf.
For yum, use the following command
sudo yum install nano -yIf using dnf, then use the following command
sudo dnf install nano -yAfter running one of the commands above, you just need to wait until the process is complete.
2. Check Nano Version
After the installation process is complete, you can check the version of Nano you have installed using the following command
nano --version3. Try Using Nano
Finally, you can try using the nano editor to edit or create a new file. For example, if you want to edit or create a new file named coba.txt, then you can use the following command
nano coba.txtOr you can also use nano to directly edit a file located in a specific folder. For example, the file /home/coba-nano.txt
nano /home/coba-nano.txtAfter you have added text to the file, you can save the changes by pressing the CTRL + O keys (the letter O, not zero) and there will be a confirmation asking if you want to change the file name or not. If you are not changing the file name, you can simply click Enter.
Finally, to exit the Nano Editor, you can press the CTRL + X keys, and if there are any unsaved changes, you will need to confirm whether the changes should be saved or not.
COMMENTS
Loading...