linux-(Type,vim)

Source: Internet
Author: User

Type command 1. Command format:

Type [parameters] [command]

2. Command function:

Use the type command to easily find out whether a given command is an alias, a shell built-in command, a file, a function, or a keyword. You can also find the actual path to the command.

3. Command parameters:

The-P option finds the absolute path to a given Linux command.

The-a flag displays the type of the given command and its absolute path.

4. Usage examples:

? ~ type ls

LS is a alias for ls-g

? ~ Type type

Type is a shell builtin

? ~ type mkdir

mkdir Is/bin/mkdir

? ~ type-a ls

LS is a alias for ls-g

LS Is/bin/ls

? ~ type-p ls

LS Is/bin/ls

Vi/vim Editor Command mode

Command mode, you can perform tasks such as saving files, running commands within VI, copy/cut/paste operations, and find/replace. When in insert mode, you can press the escape key to return to command mode.

Insert Mode

In insert mode, you can type the contents of the file. Press I in command mode to enter insert mode.

Exit Vi

Press the ESC key to enter command mode. Use two commands to exit Vi, depending on the needs of each:

    • Do not save exit – Enter in command mode: q!
    • Save and exit – Enter in command mode: WQ
Move Cursor

K Move the cursor up one line

J Move the cursor down one line

H moves the cursor one letter to the left

L MOVE the cursor right one letter

PS: If you want to move up or down multiple lines by one command, or move left or right, you can use 4k or 5j, and the two commands will move up 4 lines or 5 letters to the right.

0 move the cursor to the beginning of the line

$ moves the cursor to the end of the line

NG moves the cursor to the nth row

G move the cursor to the last line of the file

{Move the cursor to the previous paragraph

} move the cursor to the next paragraph

Edit Text

Enter insert mode to edit the current file:

I insert content where the cursor is in the same row

I Insert content at the beginning of the line where the cursor is located

A inserts the contents after the current cursor

A inserts the content at the end of the cursor line

o Add a row after the current cursor line

O add a row before the line where the current cursor is located

Delete Text

Use in command mode:

DD Delete the entire line of the cursor, you can add a number before DD, for example, 2DD can delete two lines from the line where the cursor is located

d$ Delete all rows starting at the line where the cursor is located

d^ Delete all lines from the beginning of the file to the line where the cursor is located

DW deletes everything from the cursor position until the next word begins

Copy and paste

YY Copy the current line, add a number before yy can copy multiple lines

P Paste the copied line after the cursor

P paste the copied line before the cursor

linux-(Type,vim)

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.