Command Shell to learn

Source: Internet
Author: User

For i in a B C

Do

Echo $i

Done

!ser Historical complements

> Correct information output file

>> correct information output file, append

2> error message output file

2>> error message output file append

&>> all outputs

free-m | Grep-i Mem | awk ' {print $4,$3} '

PWD current Directory

ID Current Login User

Add a user to the group

Gpasswd-a User1 Root

CHOMD a+w (All) u+w (user) g+w (group) o+w (other users)

Specify user chmod with Setfacl/getfacl

Specify another user's permissions on a command

Visudo

For i in ' ls '

Do

echo "---> $i"

Done

Name= "Fasdfsad" (no spaces in the middle)

$ (variable)

Echo $name

Read-p "fasdfsadfs->" name

Echo $name

---------

Case $ in start)

echo "Start"

;;

Stop

echo "Stop"

;;

Esac

echo $ (($1+$2))

Expr $ + $ (must have a space)

$ #个数 $* All contents $? Last command status $ A program name

For I in $*

Do

Echo $i

Done

if [[$ = = 0]]; Then

echo "OK"

Else

echo "No"

Fi

num = ' Expr 2 + 3 + 4 '

num = ' Expr 4 \* 2 '

Echo-e recognize \ n characters-n No line break

Echo-e "\033[32;40maaaaa\033[0m"

033[foreground color, background color m

033[0m Restore System Colors

[-d/root/aaa.txt] && echo "yes"

Command shell Learning

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.