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