Marco -51cto-linux Training-Job 3

Source: Internet
Author: User

Exercise 1: Create a new x_m, X_n, Y_m, y_n directory under/tmp

Mkdir-pv/tmp/{x_,y_}{m,n}

Description:-P Creates a parent directory if there is no parent directory.

-V Displays the creation process.

Exercise 2:

1) Display the/etc/directory, beginning with a non-letter, followed by a letter and any other arbitrary length of any character file or directory

ls/etc/[^a-z][a-z]*

Note: ^ denotes inverse and the letter range in square brackets is case insensitive. If the title starts with a capital letter, follow

A file or directory with a letter and any character of any length, the command statement is variable to:

ls/etc/[^[:upper:]][a-z]*


Summary: * matches any character of any length

? Match any single character

[] matches any single character within the specified range

[^] matches any single character outside the range

           [:lower:] lowercase letters [A-Z]
           [:upper:] Capital Letter [a-z]
           [:alnum:] big, lowercase letters and numbers [0-9a-za-z]   with [: Alpha:]?
           [:d igit:] number [0-9]
           [:space:] Blank character
           [:p UNCT:] punctuation

2) Copy all files or directories ending with. D in the/etc directory to the/tmp/magedu.com directory

mkdir/tmp/magedu.com

Cp-r/etc/*.d/tmp/magedu.com/

Description:-R recursion, which includes subdirectories.

Also try some parameters, when the/tmp/magedu.com path does not exist, you need to first build this directory, and then copy.

Exercise 3:

1) Replace the lowercase letter in the/tmp/readme.test file with uppercase letters and write the results to the new file 1.txt

tr [A-z] [a-z] </tmp/readme.test >1.txt (note that there are spaces between the two brackets)

2) Remove the section (1) from the/tmp/readme.test file

TR ["(1)"]</tmp/readme.test or TR "[(1)]" </tmp/readme.test (7.1 test passed)

Exercise 4:  

1) Execute LS to list the directory file and save the output to the file test

ls-l |tee test

2) Execute LS to list the directory file and append the output to test

ls-l |tee-a test

Description : -A appends to the file

-I does not receive interrupt signal, only [Ctrl]d end

Marco -51cto-linux Training-Job 3

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.