Linux Basic Features Summary II

Source: Internet
Author: User

Computer Fundamentals

Linux History

File management (viewing, processing)

Directory Management

LHS

Timestamp, time, shutdown

Philosophical thought

File naming


Basic features of Bash

Command line expansion

Command completion

Path completion

Glob

Shortcut keys

Pipeline

I/O redirection

Alias

Hash


Variable


Grep,egrep,fgrep


Variable

Configuration file

Arithmetic Operation expressions

To test an expression

Exit Status Code


Variable:

Defined

Variable name

Variable

Data type

Variable type

Variable type function (the format, scope, and participating operations of the stored data)

Strongly typed

Weakly type 1 does not have to define 2 direct assignment, the default storage is the character type 3 call when implicit conversion


Bash-scoped variables

Local, environment, local, location, special variable effective range

The law of variable commands

1 cannot start with a number, cannot use a keyword

2 See the meaning of the known

3 Avoid All caps, _ start

The law of file naming

1 cannot start with a number, cannot use special characters (Glob wildcard character)

2 Case-sensitive

3 cannot be/[^/]

4 Length <255

5. Start with a hidden file


Philosophical thought

File/Combo Applet/Text implementation configuration/try not to interact


Grep. [] [^]  * \+ \? \{m\} \{m,n\} \ (\)

Egerp. [] [^]  * + ? {m} {m,n} () |

^,$


Egrep or "grep does not support"

[ABCD] character-level or

C|cat left or right whole

(c|c) at group or


Assigning values to variables

Name= ' value '

Name to name a single memory space

= Assignment Symbol

Assignment: Stores the value in the memory space represented by the variable


‘ ‘

“ ”

Value values

Plain Text Reference Assignment

Name=obama

Space?

The variable reference implementation assigns a value stored in a variable memory space to the CPU register, which is processed to save the memory space.

Name= "Obama Jerry"

Name= $name # #存回原处

var= $name # #存到另一处

Command Reference Implementation Assignment

Name= ' Command '

name=$ (command)


Quote Strong, weak

${name} $name the scene used


Undo: Unset


Local variable view: Set

Environment Variables View: Export env printenv

Do not assign a value to an uppercase letter, which may cause bash to change its working characteristics

PS1 characters in front of the command prompt

Search path of the path command

Uid

SHELL


Positional variables: Similarly, the regular expression engine records the contents of a pattern in parentheses into a built-in variable, \1,\2,\3

Bash saves the arguments passed to the script in the built-in variable, $1,$2,$3, which can be called in the script, or empty if not present.

Special variables:

$

$#

[Email protected]

$* as a whole

$? Execution status result of the command


Port change operator

Shift #


Arithmetic operations

Let arithmetic op-expression

Let var= $num 1+ $num 2

Variable reference Assignment

var=$[arithmetic operation expression]

var=$ ((arithmetic expression))

Command Reference Assignment

var=$ (expr arithmetic operation expression)

var=$ (expr $num 1 + $num 2)


Generate random numbers

Let $RANDOM% $VAR

$[$RANDOM%10]

$ (($RANDOM%10))

$ (expr $RANDOM% 10)


Configuration file

Global:/ETC/{PROFILE,PROFILE.D}/ETC/BASHRC

Personal: ~/.BASHRC, ~/.bash_profile

Function

Profile environment variables, scripts

BASHRC local variable aliases

Login mode, read configuration order

Interactive Login

Login or su-[l] user who needs to enter a password

/ETC/PROFILE/ETC/PROFILE.D ~/.bash_profile

~/.bashrc/etc/bashrc


Non-interactive Login

Login or Su user graphics terminal that does not need to enter a password

The script runs in the current Shell child shell process

~/.bashrc/etc/bashrc/etc/profile.d


To test an expression

Numerical test

Symbol:-eq,-ne,-gt,-ge,-lt,-le

Character testing (quotes are required for both sides, except that the pattern cannot be quoted and can only be used in [[]])

Symbol: = =,! =,;, <,-Z "string"-N "string" A =~ pattern (patterns of regular expression character combinations)

File test

Symbol


Exit Status Code

Exit [#]





This article from "Reading" blog, declined reprint!

Linux Basic Features Summary II

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.