gb
  English
Phone:  +1 (217) 636-4164
Skype:  onegbits
  1. Home
  2. Blog
  3. Nano, Linux Command-Line Text Editor

Nano, Linux Command-Line Text Editor

Nano, Linux Command-Line Text Editor

14

Feb, 18

560

Nano is a Linux simple text-editor that’s very user friendly. In this tutorial, we will show you how to install and use Nano text editor. Nano will enable you to edit text files in your Linux command line environment. There are more advanced text editors such as vim and emacs for Linux OS but Nano is straightforward and easy to use that’s why it’s one of the most popular text editors for Unix systems.

Installing Nano Text Editor

To install Nano On Debian / Ubuntu distributions use the following command:

sudo apt-get install nano

Install Nano on CentOS / RHEL using following command:

yum install nano

Running Nano

Use nano command to run this text editor.

nano filename

If you do not specify filename, it will open an empty file and when you want to exit editor, it will ask you to provide a file name.

If you want to open an existing file with its path, use the following syntax:

nano /path/to/filename

For example at the following command we have used this command with test.txt file:

1_10

At the top of the program you see the name of the file you’re editing. If you have a new file that isn’t saved yet, you’ll see “New File” at the buttom of window. The final two rows at the bottom are the shortcut lines that make this program very user-friendly:.

Nano Shortcuts

Shortcuts are Nano editor functions, such as saving, quitting, etc. The most common functions are listed at the bottom of the screen, but there are many more that are not mentioned.

Notice: Nano does not use the Shift key in its functions. All shortcuts use lowercase letters, so Ctrl+G is NOT Ctrl+Shift+G.

To see a list of functions you can use Ctrl+G

2_8

Use Ctrl+X to exit help.

If you opened a new file and you want to save it. This is called “writing out” and you can do it by hitting Ctrl+O. It will ask you for a filename.

3_3

You can cancel any commands by typing Ctrl+C.

To quit nano, just hit Ctrl+X. Nano will ask you if you want to save your file.

Moving around a text file

You can use the Home, End, Page Up, Page Down, and the arrow keys to move around the file. Instead, you can use some keys combinations that we mentioned below:

Type Ctrl+F and Ctrl+B to move the cursor forward or backward.

Type Ctrl+P and Ctrl+N to move up and down one line at a time.

Instead the Home and End keys,you can use Ctrl+A and Ctrl+E respectively.

To moves down a page, use Ctrl+V

To moves up a page, use Ctrl+Y

Hit Ctrl+C to see where your cursor currently is.

Copying, Cutting, and Pasting

If you want to copy text, “mark” it by using the Ctrl+^ command. Move the cursor to where you want to start marking, then hit Ctrl+^ to “set” it.

Hit Meta+^ to copy the marked text.

Hit Ctrl+K If you want to cut the text.

Move the cursor to a suitable position and hit Ctrl+U to Paste your text,.

In configuration files, sometimes you need to remove an entire line of text, to perform this, hit Ctrl+K there is no need to highlight anything.

That is all. Yiu have finished Nano, Linux Command-Line Text Editor tutorial.

simply leave a comment in the comments section.

 

Leave A Comment
We are with you

24 X 7 X 365

+1 (217) 636-4164

©2018 1Gbits. All rights reserved