How to Install and use Nano Text Editor on Linux
In this tutorial we are going to discuss how to install and use nano text editor on your Linux VPS server. By knowing about this you can edit textfiles in your Linux VPS server on the command line interface when you are logged in utilizing SSH.
Installing Nano Text Editor
It completely relies on what operating system because some of the OS comes with Nano text editor installed. If this is the situation, you can directly move to 2nd step.
To install Nano text editor on your Linux VPS server, you should have any kind of package installer on your system.
Install Nano On Debian or Ubuntu
sudo apt-get install nano
Install Nano On CentOS or RHEL
yum install nano
That is fundamentally is for installation, you ought to have the capacity to utilize nano text editor now. You can test it out by composing this command:
It should open another text editor window and in the event that you roll out any improvements to this file, they will be saved under the name test.txt. To exit Nano, until further notice, press CTRL + X. It will you request that whether save changes in the document. Enter y for yes and afterward press ENTER.
Using Nano text editor
Opening and closing the Nano editor
The primary command to open the text editor is:
For instance, to open a file in the present working directory
To open a file in some other directory
After running the above command, you will be taken to the text editor window where you would now be able to openly alter the file with the Nano text editor. Utilize arrow keys on your console to move the cursor around the content.
At the end ot the Windows screen, you view few of the shortcuts to utilize with the Nano text editor. Symbol ^ refers you should hit CTRL_ [Key] (CMD + [Key] for Mac OS users) to utilize the selected command.
To save the modification done in the file and continue modifying hit CTRL + o.
Press CTRL+X to exit from the editor. In case you have done any modifications to the presently opened file, it will ask whether to save those changes or not. Press y in case you wish to save those modifications and then hit ENTER.
sudo nano -w /etc/apache2/apache2.conf
To choose text go to the start of the content to be chosen and press ALT +A. This will set a mark for choosing, at that point move over the content to be chosen using the arrow keys. This will check the content chose. To copy the chose content press ALT + 6 . This will copy content to the clipboard. To cut content press CTRL + K. To paste content press CTRL + U. In the event that no text is chosen before replicating or pasting it will copy/cut the whole line.
Searching or Replacing text
Use CTRL + W to search in the text area. It will approach you for the content to be searched. Put search text and hit ENTER. To look again for a similar content press ALT + W .
To get and replace text hit CTRL + W and then hit CTRL + R. It will request the first content and the content to be replaced by. It will take you to the main example of the content and request that you whether replace it or the majority of the events.