19 C
Jaipur
Saturday, November 28, 2020

How do I open a nano file in Linux? – Linux Hint

Must read

Daniel Dubois vs Joe Joyce live stream: how to watch the fight from anywhere tonight

After two previous false starts, this much-anticipated face off between two of Britain's best heavyweights finally gets to take place tonight. Don't miss a...

The Apple Watch 6 drops to lowest price ever in post-Black Friday deal

While Black Friday proper is technically over, you can still find incredible deals that are available today. Amazon has already started its Cyber Monday...

Jake Paul vs Nate Robinson live stream: how to watch tonight’s fight from anywhere

Social media star-turned-professional-boxer Jake Paul steps in the ring once more, this time to face another career-change fighter - read on for full details...

Mike Tyson vs Roy Jones Jr live stream: how to watch the big fight anywhere today

The long wait is nearly over. In just a few hours, two of boxing's all-time greatest fighters are putting the gloves back on for...

In the following post, you will see how to open a new or an existing file in Nano editor. The commands have been tested on Ubuntu 20.04 LTS Terminal.

Open a new file in Nano

There are two methods for opening a new file in the Nano editor:

Method #1

In this method, we will first open the Nano editor and then create a new file.
1. Open the Nano editor (if not already opened):

It will open an empty file in Nano editor. Hit Ctrl+o, type a name for the file, and then save it by hitting Enter.

Method #2

In the following method, we will open the file right from the Terminal (command line).
1.Type nano followed by the name of the file which you to open (create) in Nano editor.

Example:

This command will create a new file named “test” for editing in Nano editor.

Open File in Nano Editor

Open an existing file in Nano

There are two methods for opening an existing file in the Nano editor:

Method #1

In this method, we will first open the Nano editor and then open an existing file.
1.Open the Nano editor:

2.Then to open a new file in Nano, hit Ctrl+r. The Ctrl+r (Read File) shortcut allows you to read a file in the current editing sessionOpen Existing File in Nano Method 1
3.Then, in the search prompt, type the file name (mention full path) and hit Enter.


It will open the existing “sample.txt” file in the Nano editor.

Method #2

In this method, we will open the file right from the command line.
1.Type nano followed by the name of the existing file:

Example:

This command will open the “testfile” for editing in Nano editor.

Open Existing File in Nano Method 2

Open multiple files in Nano and switch between them

To open multiple files in Nano editor, type nano followed by the name of all files:

Example:

$ nano sample.txt testfile.txt report.txt

In the above screenshot, 1/3 indicates the first file (out of three files) is currently being edited. To switch between these files (move forward and backward), use the following shortcut:

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Daniel Dubois vs Joe Joyce live stream: how to watch the fight from anywhere tonight

After two previous false starts, this much-anticipated face off between two of Britain's best heavyweights finally gets to take place tonight. Don't miss a...

The Apple Watch 6 drops to lowest price ever in post-Black Friday deal

While Black Friday proper is technically over, you can still find incredible deals that are available today. Amazon has already started its Cyber Monday...

Jake Paul vs Nate Robinson live stream: how to watch tonight’s fight from anywhere

Social media star-turned-professional-boxer Jake Paul steps in the ring once more, this time to face another career-change fighter - read on for full details...

Mike Tyson vs Roy Jones Jr live stream: how to watch the big fight anywhere today

The long wait is nearly over. In just a few hours, two of boxing's all-time greatest fighters are putting the gloves back on for...

Black Friday smartwatch deals: the top Apple Watch, Wear OS and Fitbit sales

The big day may be over, but late Black Friday smartwatch deals are still in abundance, with price cuts on Apple Watches, Samsung Galaxy...