37. Text Editor - Basic Usage of Nano
Contents
By using the nano text editor provided by Linux, we can easily do some simple text editing operations such as adding, deleting, modifying, etc.
Nano Version
We can take a look at the version of nano:
|
|
Editable Mode
We can open a text editor that is editable by running the nano command directly:
|
|
Let’s fill in the editor with the following two lines:
|
|
Write Content to a File
The symbol ^ (caret) corresponds to the ctrl key on our keyboard.
We can use the combination keys (Ctrl+O) to specify the name of the file that is used to hold the content:
|
|
We can use the combination keys (Ctrl+X) to exit nano program.
Let’s take a look at the contents of the file we just created through the nano editor:
|
|
Enable Mouse Operation
Nano also provides mouse support by adding the -m parameter:
|
|
We can try clicking on the red box area in the screenshot shown above.
We can click the cancel option to exit to the editor page:
We can click the exit option to exit the editor.
Viewable Mode
We can enter the view mode with the-v parameter provided by the nano tool, in which all of our edits on the specified file are invalid.
|
|
As shown in the screenshot below, we can’t do any changes to the file inside viewable mode.
Edit an Existing File
We can use nano to edit an existing text file:
|
|
References Nano 2.3.x Command Manual
Author Dong Chen
LastMod Sat Mar 9 2019