Nano

How do I open a nano file in Linux?

How do I open a nano file in Linux?
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):

$ nano

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.

$ nano filename

Example:

$ nano test

This command will create a new file named “test” for editing 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:

$ nano

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 session
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:

$ nano filename

Example:

$ nano testfile

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

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:

$ nano file1 file2 file3

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:

alt+.

Wesnoth 1 Savaşı.13.6 Geliştirme Yayınlandı
Wesnoth 1 Savaşı.13.Geçen ay yayınlanan 6. sürüm, 1. sürümdeki altıncı geliştirme sürümüdür.13.x serisi ve özellikle kullanıcı arayüzü için bir dizi i...
Ubuntu 14'te League Of Legends Nasıl Kurulur.04
League of Legends hayranıysanız, bu, League of Legends koşusunu test etmeniz için bir fırsattır. Linux kullanıcısıysanız LOL'nin PlayOnLinux'ta destek...
En son OpenRA Strateji Oyununu Ubuntu Linux'a yükleyin
OpenRA, klasik Command & Conquer: Red Alert gibi erken Westwood oyunlarını yeniden yaratan bir Libre/Free Gerçek Zamanlı Strateji oyun motorudur. Dağı...