How To Install And Work With Nano Text Editor In Linux?

How To Install And Work With Nano Text Editor In Linux?

   

This post was last updated on August 1st, 2020 at 10:12 am

Nano is a simple and user-friendly text editor mostly used on Unix like operating systems. It emulates the Pico text editor and provides additional features and functionalities. Unlike vim, it does not operate in different modes. In nano, the user directly interacts with the text.

This article describes how to install and use the nano text editor in Linux operating system.

How to install nano text editor in Linux

There are various distributions of Linux, each of them uses different methods to install or remove packages on them. Nano is available by default in various distributions if it is not in your system then use one of the given commands to install it –

To install nano in the Debian, Ubuntu, Linux mint, etc use –

sudo apt install nano

In Centos or RHEL use –

sudo yum install nano

If you are using Fedora use –

sudo dnf install nano

Working with the nano text editor

Creating, editing files in nano is much easier as compared to other command-line text editors available in Linux. Let us see how you can use the nano to create or edit text files.

Create a new file

To create a new file lets say file1, first open your terminal by pressing ctrl+alt+t and then use the following command –

nano file1

When you press the enter after typing this command this will open file1 for editing. You can start entering text here –

Copy, cut or paste text in the nano text editor

Press and hold the ctrl+shift and then move the cursor using the arrow keys to mark the text. And then –

  • Press the alt+6 for coping the marked text and then move the cursor where you want to paste it, press ctrl+u to paste the copied text.
  • If you want to cut the marked text press the ctrl+k. Now move the cursor where you want to paste it and press the ctrl+u to paste the text.

Search text

To search for the specific text in a file press ctrl+w this will display an option for search, As you can see in the image below. Enter the text that you want to search in this file and then press enter, this will bring the cursor to the starting of that word or pattern.

 Save the content of the file

To save the content of file1 press ctrl+s. This will save the content of the file under the file name file1. If you are saving text for the first time then it may ask you to enter the file name to write the text.

Save the content of a file with a different filename

You can change the file name while saving its content, Press ctrl+o this will give an option to edit the file name, change the name if you want and then press the enter to save it.

Or If no filename is provided till now then here you can enter the name of this file.

After entering the file name if you press enter, this will prompt you for confirmation, enter yes and then press the enter key to save it.

Exit from the editor

When you are done editing press ctrl+s to save and then press ctrl+x to exit from the editor.

Conclusion

By following the given steps you can start using the nano text editor in Linux. Now If you want to say something on this topic then write us in the comments below.

Previous [lubuntu] EFI woes
Next Help me!!!!!

About author

You might also like

Linux Topics 0 Comments

Using Sed, A Stream Editor In Linux/Unix

This post was last updated on August 3rd, 2020 at 02:42 pmSed stands for stream editor It was based on the scripting feature of ed(a line based interactive text editor

Administration 0 Comments

How To Check The Running Time Of A Process In Linux/Unix ?

This post was last updated on August 1st, 2020 at 10:13 amIn Unix like operating systems, a process is a program in execution. The running time of a process means

How To 0 Comments

How To Open A Directory with Root Privileges In Ubuntu 20.04 LTS?

This post was last updated on August 1st, 2020 at 09:07 pmIn Linux or Unix, you can perform almost any task by using a terminal. You need to have superuser

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply