The tenth chapter of the Linux command line and Shell scripting Encyclopedia uses the editor

Source: Internet
Author: User

Main introduction vim, Nano, emacs,kwrite,kate,gnome10.1 vim

Unix System's original editor

10.1.1 Check VIM Package

Figure out what kind of VIM package your Linux system is using.

Under the Wu ban map:

$which VI

$readlink –f/usr/bin/vi

READLINK–F * * * can immediately find the last link file

So VI is the execution program/usr/bin/vim.basic

Installation: sudo apt-get install vim

10.1.2 Vim Basics

There are two modes of operation:

(1) Normal mode: When open/new, the key will be interpreted as a command

(2) Insert mode: Each key entered at the current cursor position is inserted into the buffer

Press I into the insert mode, there are other keys, such as O

Press ESC to enter normal mode.

Exit VI:

Q: If the buffer data is not modified, exit

q!: Cancels all modifications to the buffer data and exits

WQ: Save to file and exit

W FileName: Save the file to another file

There is also a shift + z + Z: also save exit

Some other commands:

G: Skip to the last line

Num G: Adjust to the specified line

GG: Move to the first line

PageUp (ctrl+f): Flip one screen

PageDown (ctrl+b): Flip one screen

10.1.3 Editing data

U: Undo Previous Edit Command

A: Append data after the current cursor

O: The next line of the cursor inserts data

DW Delete a Word

d$ Delete to end of line

DD: Delete Row, 5dd delete 5 rows

The use of backspace and delete keys in normal mode is not recognized.

10.1.4 Copy and paste

DD can be pasted with p after deletion.

The copy command is Y,

YW copy a word

y$ Copy to end of line

Then use p to paste

10.1.5 Find Replacement

: s/old/new/g a line command to replace all old, which is replaced only on one line

: N,ms/old/new/g replaces the old between line number N m

:%s/old/new/g replace entire file with old

:%S/OLD/NEW/GC replaces the entire file's old, and prompts each time it appears

10.2 Nano Editor

No, not in the computer, just a quick look.

Note: The bottom of the Nano Editor window displays individual commands along with a brief overview. ^ Indicates is CTRL

For example, ^x is ctri+x. Are not case-sensitive when used.

10.3 Emacs Editor

appear earlier than UNIX. It was also the console editor and has now migrated to the graphical world.

Many distributions don't have Emacs installed.

10.4 KDE Editor

The KDE project officially supports two popular text editors

(1) KWrite: Provides a simple word processing type of text editing function, also support syntax highlighting

(2) The flagship editor of the KATE:KDE project, a bit more powerful.

10.5GNOME Editor, that's gedit.

F9 can display the currently edited document on the left. You can also start side Pane from the View menu

You can also set preferences. Preferances menu item.

The Linux command line and Shell Scripting Encyclopedia, chapter tenth, using the editor

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.