Linux nano editor commands common methods work notes

Source: Internet
Author: User

In this article, you may also sort out the commonly used nano command usage methods. If your memory is poor, use the text to record them and try again later.

1. Install the nano editor

1. CentOS

Yum-y install nano
2. Debian

Apt-get install-y nano
Some default Linux system environments do not have the nano editor installed. When executing the command, you will see "-bash: nano: command not found ", then we use the above command to install the nano editing environment.

II. Common usage of nano

1. Ctrl + X

Exit the current editor, and then prompt whether to save and exit. If you need to save, enter Y and press Enter. If you do not need to save, enter N and press enter.

2. Ctrl + O

Save the changes to the file.

3. Page flip

Ctrl + Y to the previous page, Ctrl + V to the next page

4. Search

Press Ctrl + W and enter the required keyword and press Enter. The first matching text will be located. If we need to see the following, Alt + W will be used to locate the next matching text.

5. Copy, cut, and paste

Copy the entire row: Alt + 6; cut and paste the whole row: Ctrl + K; paste: Ctrl + U

6. Fast moving

Ctrl + A move to the beginning of the row; Ctrl + E at the end of the row

7. Edit a file

Nano file name

Third, other nano command parameters

-A. Start the smart home key function.
-B supports saving existing files
-F supports multi-file caching
-H History
-I ignore nanore files
-N: do not convert files from DOS/Mac Format
-O reference string
-R search
-C: Display the cursor position
-D solve the problem of space key and Del key confusion
-K cut
-L if it is a connection symbol, a new file will be generated without modifying the source file.

Get help
After entering the nano interface, there are two menus below, for example, "^ G Get Help ". Its significance is as follows:

^ G means that the shortcut key is Ctrl + G, and "Get Help" is of course a function.

Follow these prompts to start using nano immediately, or press Ctrl + G to see help.

Note: In nano, black and white characters indicate shortcut key operations. "^" Indicates the Ctrl key, and Ctrl + G indicates the "^ G ". M represents the Alt key, and Alt + W represents the M-W ".

To sum up, for common users, we only need to learn simple editing, saving, and exiting. vi and nano functions are similar, so we don't need to compare them with others. We can use them.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.