Linux vi command details and usage tips (1)

Source: Internet
Author: User

Access the vi command

Vi filename: open or create a document and place the cursor at the beginning of the first line

Vi + n filename: Open the document and place the cursor at the beginning of line n

Vi + filename: Open the document and place the cursor at the beginning of the last line

Vi +/pattern filename: Open the document and place the cursor at the first string matching pattern

Vi-r filename: a system crash occurred when vi was being edited last time, restoring filename

Vi filename... filename: open multiple documents and edit them in sequence

Move cursor command

H: move the cursor one character to the left

L: move the cursor one character to the right

Space: move the cursor one character to the right

Backspace: move the cursor one character to the left

K or Ctrl + p: move the cursor up a row

J or Ctrl + n: move the cursor down a row

Enter: move the cursor down a row

W or W: move one word to the beginning of the word to the right of the cursor.

B or B: move one word left to the beginning of the word

E or E: move the cursor right to the end of a word j.

): Move the cursor to the end of the sentence.

(: Move the cursor to the beginning of the sentence.

}: Move the cursor to the beginning of the paragraph

{: Move the cursor to the end of the paragraph

NG: move the cursor to the beginning of line n

N +: move the cursor down n rows

N-: Move n rows above the cursor

N $: move the cursor to the end of line n

H: move the cursor to the top line of the screen

M: move the cursor to the middle line of the screen

L: move the cursor to the last line of the screen

0: Note that the number is zero.) move the cursor to the beginning of the current row.

$: Move the cursor to the end of the current row


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.