1.1Add a userMySQLSpecifyUIDto be888, disable login and do not create home directory.
Useradd-u 888-m-s/sbin/nologin MySQL
1.2Brief IntroductionRAID0 RAID1RAID5 RAID10working principle and characteristics?
RAID 0 at least one hard drive reads and writes fast but without redundancy a piece of bad overall collapsed
RAID 1 only two hard drives read and write relatively poorly there is a hard disk that is redundant but also loses the capacity of a piece of hard disk. A maximum of one hard drive is lost;
RAID 5 minimum three HDD read and write speed between 0 and 1 a hard disk to do backup, a maximum loss of a hard disk;
RAID 10 minimum four block hard disk read and write performance good loss two hard disk to do redundancy maximum loss of two hard drives;
1.3List/usr/The amount of space occupied by each subdirectory under the directory
Df-h/usr/*
1.4fill in the blanks questions: ABlock2TBthe hard drive is not consideredHotsparethe case of doingRAID0,RAID1,RAID5the rear space is respectively(no redundancy is all for capacity: -), (loss of a piece of hard disk to do redundancy, capacity: A), (divided into One-third to do redundancy, capacity: A). 1.5name the common interface type for the disk.
SATA SAS PCI-E
1.6sedCommand Exercises
[[Email protected]~]# cat/tmp/passwd
Root:x:0:0:root:/root:/bin/bash
BIN:X:1:1:BIN:/BIN:/SBIN/NOLOGINDAEMON:X:2:2:DAEMON:/SBIN:/SBIN/NOLOGINADM:X:3:4:ADM:/VAR/ADM:/SBIN/NOLOGINLP: X:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/ Haltmail:x:8:12:mail:/var/spool/mail:/sbin/nologinuucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
Cat >passwd.txt<<eof
Root:x:0:0:root:/root:/bin/bash
BIN:X:1:1:BIN:/BIN:/SBIN/NOLOGINDAEMON:X:2:2:DAEMON:/SBIN:/SBIN/NOLOGINADM:X:3:4:ADM:/VAR/ADM:/SBIN/NOLOGINLP: X:4:7:lp:/var/spool/lpd:/sbin/nologin
Sync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
Halt:x:7:0:halt:/sbin:/sbin/haltmail:x:8:12:mail:/var/spool/mail:/sbin/nologin
Uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
Eof
1.6.1Remove all spaces at the beginning of each line
Sed ' s#^[]# #g ' Passwd.txt
1.6.2enclose all lowercase letters in parentheses ().
[[Email protected] etc]# sed ' s#[a-z]# (&) #g ' passwd
1.6.3Delete the first three rows
Sed '/root/,/bin/d ' passwd
1.6.4ShowBin-haltlines between the beginning
Sed-n '/bin/,/halt ' passwd
1.7ShellExam Questions1.7.1CentOSthe defaultShell
#!/bin/bash
1.7.2The known script looks like this
#cat test.sh #!/bin/bash user= ' WhoAmI '
Ask SH test.sh after the echo $user return results?
null; user is not an environment variable
[Email protected] ~]# sh ceshi.sh && echo $user
[Email protected] ~]#
1.7.3 Shellvariables are divided into
1. Environment variables
2. Common variables
3. Special variables
1.7.4describe the type or effect of the following variables
Export oldgirl=oldboyedu oldgirl is an environment variable, passwd is a special variable
$ A file for the current shell
$ $ The third parameter of the current shell
$# all parameters of the current shell
$? Show whether the command executed successfully
1.7.5find the wrong variable name below
①x
②name
③password
④1jia
⑤123
⑥z_123
6, because a variable can only start with a letter or an underscore, rather than a letter or underscore
1.7.6Write2environment variable configuration file and a1List of
/etc/profile
/etc/bashrc
/etc/profile.d
1.7.7write the corresponding script according to test instructions
Determine if the/data directory exists, enter the directory and view the file properties
#!/bin/bash
if [-d/data]
Ll/data
Fi
Determine if the/etc/hosts file exists, and then copy the file to the/tmp directory.
#!/bin/bash
if [-f/etc/hosts];then
\cp/etc/hosts/tmp
Fi
[Email protected] ~]# ls-lrt/tmp/hosts
-rw-r--r--1 root root 188 Nov 00:49/tmp/hosts
This article from "Dream for the Horse not negative" blog, declined to reprint!
"End claims" linux-Fifth Test question