Common shell commands

Source: Internet
Author: User
Tags clear screen

What is a shell?

The shell has some common command set, which is an instruction for invoking the inner core of the system.

Here's a list of some common shell commands

ls: View all files in the directory

-L : View file Details

-A: View all files, including hidden files

PWD: View the directory where your current work is located

CD: Go to a directory

CD ~ : Returns the user's home directory

Cd.. : Returns to the previous layer

CD Absolute Path

CD relative path

Clear: Clear Screen

Logout: Log Off users

Shutdown: Off

-H : Shutdown

-R: restart

-K: Warning

-C: Cancel

Halt: Shut down the machine

Reboot: Restart

VI Shortcut keys

1) move cursor

H : Move the cursor one character to the left

J : Move the cursor up one character

K : The cursor moves down one character

L : Move the cursor right one character

0 : Cursor moves to the beginning of the line

$ : Cursor moves to end of line

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

M : Move the cursor to the middle of the screen

L : The cursor moves to the bottom line of the screen

2) Insert text

I : Insert content in front of cursor

A : Insert content after cursor

o : Insert a new row on the next line of the row

O : Insert a new row on the previous line of the row

3) Delete text

X: Delete the character following the cursor

X: Delete the characters in front of the cursor

NX: Delete n characters after cursor

NX: Delete n characters before the cursor

D0: Delete the cursor to the beginning of the text

d$: Delete the cursor to the end of the line

DD : Delete entire row

NDD : Delete n rows down

4) Copy text

YY : Copy entire row

Nyy : Copy n rows

P : Paste the next line in the same row

P : Paste a line on the same row

DD : Cut

5) Find text

/pattern : Looking down

? pattern : Find up

N : Sequential lookup

N : Reverse Lookup

: s/p1/p2/g : In the current line, replace p1 with p2

: n1,n2s/p1/p2/g : replace p1 between N1 and n2 rows with p2

6) screen tumbling

Ctrl+u: First half screen to file

Ctrl+d: Half-screen to the end of the file

Ctrl+f: Flip a screen to the end of a file

Ctrl+b: Turn one screen at the top of the file

7) last line command

: N1,N2 CO n3 : Copy the N1 to n2 line below the N3 line

: n1,n2 m n3 : cut N1 to n2 line below N3 row

: N1,n2 d : delete N1 to n2 Row

: w Save

: Q Exit

: x Save and exit

: q! Force Exit

: w! Force Save

: numbers are positioned to the specified line

: Set nu Displays line number

: Set Nonu cancel line number

U: Cancel last action

Common shell commands

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.