To learn more about nano, check this out:
Today, we will explore how to use a nano editor to open files. Here, you will learn multiple ways to use nano editor to edit files. By the end of this article, you will become comfortable with using this editor. We have used Manjaro Linux 21 to demonstrate the process.”
Let’s begin!
Guide
Following are some of the ways you can open a file using Nano editor:
Method 1: Open Nano First, and Then the File
In this method, we will open the Nano editor first and then open the file by typing the file name.
To open the editor, run the nano command like this:
Once the editor is open, press Ctrl + O and write the name of the file, you want to open, and then hit enter to save it.
Method 2: Open a New File Directly From Terminal
In this method, we will show you how to create and open a new file directly from the command line.
We will follow the following Syntax:
To create and open the new file, type nano followed by the filename and then hit enter to execute the command:
This will create a new file and open it like this:
Method 3: Open an Existing File From the Command Line
Now let’s see how to open an already existing file on your machine.
First, go inside the directory where the file is saved. Once you are inside the directory, run the command “nano” followed by the filename as shown below:
As you can see, the sample.txt file is now open to be edited with nano editor.
Method 4: Open Multiple Files From Terminal
Instead of opening just one file, you can also open multiple files at a time. This can be achieved by using the following command syntax:
Suppose three files already exist on your system in some directory. To open these files in parallel, go to the directory where the files are kept. Then run the nano command followed by the filenames as demonstrated below:
All three files will open.
The above window shows 1/3 of the files. To switch to test-file2.txt, press alt+.
alt+.
This is how you can switch between the three files.
Conclusion
In today’s guide, we saw in detail how we could use Nano editor using four different ways. We explored how we can create a new file using nano as well as how to open an existing file.
We hope you liked the tutorial.
from https://ift.tt/H0yNOWZ
0 Comments