Tutorial on using nano editor in centos

Source: Internet
Author: User
When using Linux, you will often deal with the editor. generally, vi and nano are commonly used. although vi is powerful, it is a little difficult to get started from new users, GNUnano is a small and powerful text editor. The usage of nano is briefly described here. Install CentOS: execute yum-yinstallnanoDebian: execute apt-g

When using Linux, you will often deal with the editor. generally, vi and nano are commonly used. although vi is powerful, it is a little difficult to get started from new users, GNU nano is a small and powerful text editor. The usage of nano is briefly described here.

Install

CentOS: execute yum-y install nano

Debian: execute apt-get install-y nano.

Create/open a file
Nano path + file name

If the file to be modified exists, the above Command will open the file; if the file does not exist, a new file will be created and opened.

Note: in Windows systems, a file should have a suffix, such as. txt, for the system to determine the type. However, Linux does not judge the type based on the suffix. Of course, there is no suffix, and example.txt can be used for example.

Cursor control

Move the cursor: Move the cursor with the arrow key.

Select text: drag and hold the left mouse button.

Copy, cut, and paste

Copy the entire row: Alt + 6

Paste a whole line: Ctrl + K

Paste: Ctrl + U

If you need to copy/cut multiple lines or A part of A row, first move the cursor to the beginning of the text to be copied/cut, press Ctrl + 6 (or Alt + A) for marking, move the cursor to the end of the text to be copied/clipped. At this time, the selected text will be reversed and copied with Alt + 6, Ctrl + K to cut the paste. To cancel text selection, press Ctrl + 6 again.

Search

Press Ctrl + W, Enter the keyword you want to search, and press enter to confirm. This will locate the first matched text, and then you can use Alt + W to locate the next matched text.

Flip

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

Save

Use Ctrl + O to save the changes

Exit

Press Ctrl + X

If you have modified the file, you will be asked if you need to save the modification. Enter Y to save, enter N to save, and press Ctrl + C to cancel the return.

If Y is entered, the next step will ask you to enter the file name you want to save. If you do not need to modify the file name, press enter. if you want to save it as another name (that is, save as), enter a new name and confirm it. At this time, Ctrl + C can be used to cancel the return.

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 ".

Related Article

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.