Basic Guide to the Nano of Linux commands

Source: Internet
Author: User

Nano Basics Guide

1. Nano Foundation

Objective

This is a concise, nano-use guide that helps you quickly understand the basic uses of the Nano. For more information, please refer to:

http://www.nano-editor.org

Open file with new file

To open or create a new file using Nano, simply type:

Code Listing 1.1: Opening or creating a new file

Nano file name

The Nano is a single-mode editor that allows you to enter text directly. If you want to edit a configuration file like/etc/fstab, use the- w parameter, for example:

Code Listing 1.2: Disabling line Wrapping

Nano-w/etc/fstab

Warning: This is very important. If you forget the-w parameter when you edit the configuration file , it may cause your system to fail to start or produce other exceptions.

Save and exit

If you want to save your changes, press Ctrl+o. To exit, press ctrl+x. If you do not save your changes before exiting, it will prompt you whether you want to save. If not, press N, or vice versa, press Y. Then it will let you confirm the name of the file you want to save, confirm or modify and press enter.

If you have not modified and accidentally pressed the save key, you can cancel by pressing CTRL + C when requesting confirmation of the file name .

Cut and paste

To cut an entire line, use ctrl+k (hold down Ctrl and press the K key). The line where the cursor is located disappears. To paste it, simply move the cursor to the location you want to paste, and then press Ctrl+u. To move multiple lines, simply press the ctrl+k a few times to cut down the content you need to move, and then press once ctrl+u to paste all the content you just cut.

If you want to use more precise cut control, you need to mark the text. Move the cursor to the beginning of the text you want to cut, and press ctrl+6 (or alt+a). Then move the cursor to the end of the text you want to cut: The text that was marked is anti-white. To undo a text marker, simply press ctrl+6 once . Use ctrl+k to cut the tagged text and paste it with ctrl+u.

Search for specific text

When you want to search for a particular text, it's easy to think of it as "Whereis" rather than "search". Just press ctrl+w, type the string you want to search for, and then press enter. To search for the same string again, you can press alt+w directly.

Note: in the Nano Help document, Ctrl-key is represented as a caret (^), so Ctrl+w is written as ^w, and so on. The alt-key is represented as a M (from "Meta"), so Alt+w is written as a m-w.

More options

If you are interested in adjusting the nano settings, be sure to check out the /etc/nanorc.

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.