Linux self-study note--bash features

Source: Internet
Author: User

Bash features

1.{} and ()

{}: Similar collection, Mkdir-p./test/{a,b} Copy/etc/passwd{,.bak}

 (): the execution result of the reference command, mkdir $ (date)

2. Judgment of execution results

echo $?

Success: 0

Failure: 1~255

3. Common shortcut keys

Ctrl+l: Clear Screen

CTRL + A: Cursor jumps to the top

Ctrl+e: Cursor jumps to the end of a career

Ctrl+u: Before deleting the cursor

Ctrl+k: After deleting the cursor

esc+.: Output The object that was last executed

4.globbing pass-to-match mechanism

*: matches any character of any length

?: matches any single character

[]: matches a single character within a specified range, [0-9][a-z][a-z]

[^]: matches a single character outside the specified range

[[: Space:]]: white space characters

5.IO redirection

Coverage: >

Add: >>

Error: 2>,2>>

Merge Normal and error: &>,&>>

Create multiple lines of text: Cat << EOF

...

Eof

Create multi-line text files: Cat >./test << EOF

...

Eof

Looping through row data: while read I;do

Echo $i

Done </etc/passwd

Data black hole: Useradd-r system &>/dev/null

6. Piping

Command Delivery: CAT/ETC/PASSWD | grep "Varnish"

Tee command: Save the execution result of the previous command and pass it on to the subsequent command to continue processing, CAT/ETC/PASSWD | Tee./passwd.bak | grep "Varnish"

7. Aliases

Add Alias: Alias ld=ls-d

Remove alias: Unalias ld

Linux self-study note--bash features

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.