Tips for Shell common commands

Source: Internet
Author: User
Tags prev

1.cd

CD-Back to last catalog

CD returns the current user's home directory

2.mkdir

Mkdir-p Creating a multilevel directory

Eg:mkdir-p Test1/test2/test3

3.find

Find-empty Finding empty Documents

Find-user XXX View all information about user xxx

Find-mtime-1 view files that have been modified within 1 days

Find-mtime +1 view files that were modified 1 days ago

4.du

Du-h Human Vision

Du-s only show Total capacity

5.head

Head-c 2K Display pre-2KB content

Head-n Display the contents of the top N rows

6.wc

Wc-l Statistics File Line

Wc-c Statistics File characters

Wc-w statistics File Words

7.grep

Grep-i ignoring case

Grep-v Inverse Matching

Grep-w matching Words

grep--color Display Color

8.ln

Ln-s Creating a soft connection

LN creates a hard link

9.vim

HLJK corresponds to the upper or lower

GG move cursor to first line of file

G move cursor to end of file

NG moves the cursor to n rows

^ cursor moves to the current line start character

$ cursor moves to the end character of the current line

FX cursor moves to the next X character

FX cursor moves to the first X character

W cursor moves one word to the right

b The cursor moves one word to the left

NW,NB cursor Left/Right move n words

DD deletes the cursor in the row

NDD Delete N rows

d$ Delete cursor to end of line

J Delete line breaks

U Undo Previous Action

Rx replaces the current character of the cursor with the X

YY copy when moving forward

p after pasting to current line

P Paste before current line

/from top down, n next n prev

? From the bottom of the online check, n next n prev

: S/xxx/bbb/g replaces the current line of XXX for BBB

:%s/xxx/bbb/g replaces all lines of XXX for BBB

: 1,5s/xxx/bbb/g replaces 1-5 lines of XXX for BBB

ZZ Save and exit

: Set Nu (or number) displays line numbers

Tips for Shell common 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.