Linux uses text editor VI common commands

Source: Internet
Author: User

One: page

Ctrl+u up half a page

Ctrl+f up one page

Ctrl+d down Half page

Ctrl+b down one page

Two: Move cursor command

0: Cursor moves to the beginning of the current line

$: Cursor moves to the end of the current line

Three: Common INSERT, delete instructions

I: Insert before current cursor, text moves backwards after cursor

DD: Delete the line where the cursor is located

YY: Copy Current line contents to Clipboard

P: Pastes the contents of the Clipboard after the current cursor position

P: Pastes the contents of the Clipboard before the current cursor position

S: replaces the specified number of characters with the input text starting at the current cursor position

S: Deletes the specified number of rows and replaces them with the input text

Do: Delete to the beginning of the line

d$: Delete to end of line

Iv. Find, save and Exit VI

Press u--to cancel the most recent operation, which can be reversed as many times as you like.

Press u--to cancel all edits made to the current line. : w--Save current file

: wq--Save (same as command: x function)

: q--Direct exit, if modified will prompt to save

: q! --Do not save direct exit

Open a new file or read into other file contents

In the current VI editor, you can edit a new file by executing the last line command in the form ": E New file ".

In the current VI editor, the last line in the form of ": R other file " reads the contents of the other file and copies it to the current cursor location.

In the current VI editor, execute the ": R! Command " form of the Mo-line mode, you can paste the output of other commands to the text file cursor location.

Execution of the "Set number" command in the last row mode displays line numbers, and "Set Nonu" is performed to suppress line numbers.

Vi. useful parameters for the VIM editor

vim-o file1 file2; two files will be opened at the same time, displayed up and down, using ctrl+w to toggle files.

vim-o file1 file2; will open two files at the same time, left and right display, use CTRL+WW switch files.

Linux uses text editor VI common commands

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.