Take Shell notes ---- private dish of laruence

Source: Internet
Author: User
VI editing tool usage:

Common commands:

H, J, K, L correspond to the left, bottom, top, right

CTRL + F flip forward

CTRL + B flip back

0: Move to the first character of this line

G moves to the last row of the file.

N [enter] move the cursor down n rows

Ng moves to the nth line of the file

/Word searches for a string named word after the cursor

? Word searches for a string named work before the cursor

N1, N2/word1/word2/g search and replace

1, $ S/word1/word2/g

Bash Learning

What is shell? We use shell to control the work of kernel.

 

 

Bash variable:

Run the "env" command to view environment variables of the system.

Set to view the current system environment variables and custom variables.

Echo $? Check whether an error occurred during the last operation,If it is 0, the execution is correct. If it is non-zero, the execution is incorrect.

Variable definition rules:

Definition string:

Name = vbird \'s \ Name

Name = "vbird's name"

Variable accumulation definition:

Name = "$ name" ISME

Cancel variable definition

Unset name

What is the difference between double quotation marks and single quotation marks when setting variables?

Double quotation marks can retain the content of variables. single quotation marks can only be general characters without special symbols.

 

 

What does the quota (') symbol mean when you input the command again?

 

 

Use of alias and unalias:

Alias LL = 'dir'

Unalias

History

Run the command! [Number]

! Represents the previous command

BASH Shell configuration file

/Etc/profile has several important variables: for example, path user mail hostname histsize umask

The/etc/bashrc file is used to plan umask and the prompt content.

/Etc/man. config is very important to the system administrator. The content of this file regulates where man page is used.

 

Wildcard and special characters:

 

Note that not single quotes

 

Enter several commands consecutively:

Command1; command2 ";" Semicolon

Command1 & command2 must be correctly executed before the next

Command1 | no matter what the first execution status of command2 is, the subsequent command2 will be executed.

 

Command redirection:

Ls-L> Test

In the bash command execution process, there are three output input states:

Standard Input: code 0, or stdin usage: <

Standard output: Code 1, or stdout. Usage 1>

Error output: Code 2, or stderr. Usage 2>

Ls-Al 1> list.txt 2> list. Err

 

 

Command:

Workflow:

 

 

Cut usage:

Sort sorting

WC statistics

WC-l count the number of rows on the station

WC-M count station characters

WC-W count

Uniq deletes duplicate rows and displays one

Split File

 

 

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.