Use of nano Editor

Source: Internet
Author: User
The usage of the nano Editor-Linux Release Technology-Debian information. The following is a detailed description. The nano editor has been tossing for a long time. Add it to your favorites. Easy to find

In the future, we basically need to edit files to implement different settings. So what should we use to set the configuration file? Use an editor, like notepad and WordPad in windows, let's talk about the default debian Editor-nano.

First, let's check if there is any nano on the network.
There is very little nano information on the network, so I will explain how to use nano.
Let's take the network configuration file editing as an example.

GNU nano 1.2.4, nano version File: the absolute address of the File opened by/etc/network/interfaces

The following is the content of the opened file.
# This file describes the network interfaces available on your system
# And how to activate them. For more information, see interfaces (5 ).

# The loopback network interface
Auto lo
Iface lo inet loopback

# The primary network interface
Auto eth0
Iface eth0 inet static
Address 192.168.254.20
Netmask 255.255.255.0
Network 192.168.254.0
Broadcast 192.168.254.255
Gateway 192.168.254.254
# Dns-* options are implemented by the resolvconf package, if installed
Dns-nameservers 202.103.0.117 202.103.24.68
[Read 17 lines]
^ G Get Help ^ O WriteOut ^ R Read File ^ Y Prev Page ^ K Cut Text ^ C Cur Pos
^ X Exit ^ J Justify ^ W Where Is ^ V Next Page ^ U UnCut Txt ^ T To Spell

These are help columns. Haha ^ G indicates pressing ctrl + g together, haha

^ G Get Help: press ctrl and G at the same time to call up the Help menu.

Let's give it a try.
After I click it, I bring up the Help menu. I will give you the shortcut key list below. Let's try it.

Vi has always been called the most powerful editor, but gentoo and debian chose nano as the default editor.
Freebsd chose ee as the default editor. I believe that freebsd and redaht are compared in the eyes of professionals,
There is nothing to show off about redhat. Why don't they choose vi because vi operations are complicated?
The so-called simple editor nano is simple and easy to use.
In fact, it's not simple at all. It's just nano's modest.

Here, I declare ^ to indicate the ctrl key on the keyboard. The last one should be clear as long as it is a programmer. ^ G indicates pressing ctrl and g at the same time.
(F1) means that pressing (F1) is the same, and M-means using the key after alt +

^ G = F1) Invoke the help menu
Call the Help menu

^ X = (F2) Close currently loaded file/Exit from nano
Exit

^ O = (F3) Write the current file to disk = ^ O WriteOut
Save
Then press enter to save it.

^ J = (F4) Justify the current paragraph
Adjust the current section (this item is not used in the configuration file, and the format will go wrong)

^ R = (F5) Insert another file into the current one
Insert other files to the current file. tab is supported when searching for files.

^ W = (F6) Search for text within the editor

Search
^ Y = (F7) Move to the previous screen
Previous Screen
^ V = (F8) Move to the next screen
Next screen
^ K = (F9) Cut the current line and store it in the cutbuffer
Cut the current row and save it in the buffer zone

^ U = (F10) Uncut from the cutbuffer into the current line
Paste something in the buffer to this

^ C = (F11) Show the position of the cursor
Show cursor position

^ T = (F12) Invoke the spell checker, if available

Call the spelling check program

^ P Move up one line

Move up a row
^ N Move down one line

Move 1 down

^ F Move forward one character
Move the cursor forward

^ B Move back one character
Move the cursor backward

^ A Move to the beginning of the current line
Move to the beginning of the current row

^ E Move to the end of the current line
Move to the end of the current row

^ L Refresh (redraw) the current screen
Refresh current screen

^ (M-A) Mark text at the current cursor location
Mark text

^ D Delete the character under the cursor

Delete the last letter after the cursor
^ H Delete the character to the left of the cursor
Delete A Letter to the left
^ I Insert a tab character
Insert a tab Value
^ \ (F14) (M-R) Replace text within the editor

Search and replace
^ M Insert a carriage return at the cursor position
Insert a carriage return
^ _ (F13) (M-G) Go to a specific line number

Jump to a line
^ Space Move forward one word

Forward a word
M-Space Move backward one word
Returns a word.
M-] Find other bracket
Search for the next bracket

M-<Open previusly loaded file
Open the previously loaded file

M-> Open next loaded file

Open the next Loaded File

M-C Constant cursor position enable/disable

M-I Auto indent enable/disable
Whether to indent the first line

M-Z Suspend enable/disable
Hanging or not

M-X Help mode enable/disable
Help Mode

M-M Mouse support enable/disable

Mouse support

M-Y Color syntax highlighting enable/disable
Highlight the syntax

This is the exit.

Well, the nano editor will say so much.
Next, let's talk about the basic configuration files and locations.
The first is to open the efficient input location of the command line
I saw the advanced command line completion, and I don't need to remember the software package name. Oh, it's nice.

Why is ls out of color? Have you seen the color in redhat? let's change it.
No, blue is a directory, white is a file, and green is a file that can run.

Cnrot:/# ll
-Bash: ll: command not found
Tell us ll doesn't have this command
Let's make a custom command.
Remember to log out before it takes effect. You do not need to restart it.
No
No, this is a custom command.
Now, let me tell you the location of several files.

If you cannot find
First, the network configuration file/etc/network/interfaces

GNU nano 1.2.4 File:/etc/network/interfaces Modified

# This file describes the network interfaces available on your system
# And how to activate them. For more information, see interfaces (5 ).

# The loopback network interface
Auto lo
Iface lo inet loopback

# The primary network interface
Auto eth0
Iface eth0 inet static
Address 192.168.254.20
Netmask 255.255.255.0
Network 192.168.254.0
Broadcast 192.168.254.255
Gateway 192.168.254.254
# Dns-* options are implemented by the resolvconf package, if installed
Dns-nameservers 202.103.0.117 202.103.24.68

Install the source configuration file
GNU nano 1.2.4 File:/etc/apt/sources. list

# Deb file: // cdrom/sarge main

Deb cdrom: [Debian GNU/Linux 3.1 r0a _ Sarge _-Official i386 Binary-1 (20050607) $

Deb http://debian.cn99.com/debian/ stable main
The deb-src http://debian.cn99.com/debian/ stable main

Deb http://security.debian.org/stable/updates main contrib
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.