- 选择题(15分)
新建文件 : touch mkdir
cat echo vim
rm mv
- 简答题(16分)
yum 本地源配置
手动添加用户,系统变化的6个地方:
/etc/passwd
/etc/shadow
/etc/gpasswd
/etc/gshadow
/home/..
/var/spool/mail
- 操作题(48分)
权限 字母数字
chmod
cron
cut sed awk
su - sudo su 描述
改变用户名,组名
usermod
硬链接,软链接,如何建立,作用
打包,压缩
增删改查
touch\mkdir
rm -rf
vi
find\grep
别名 alias
- Shell 编程(16分)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| #!/bin/bash
read -p "input username" name read -p "input number of user" num read -p "input passwd of them" pswd
if [ ! -z "$name" -a ! -z "$num" -a ! -z "$pswd" ];then y=$(echo $num | sed 's/[0-9]//g') echo "y:[$y]" if [ -z "$y" ];then for((i=1;i<=${num};i++));do /usr/bin/useradd $name$i > /dev/null echo $pswd |/usr/bin/passwd --stdin $name$i & 2> /dev/null done fi fi
|
执行结果


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| #!/bin/bash
read -p "input username: " name read -p "input number of user: " num read -p "input passwd of them: " pswd
n=1
while [ $n -le $num ];do /usr/bin/useradd ${name}${n} -e 0
echo ${name}${n}:${pswd} | chpasswd
n=$(($n+1)) done
|
1 2 3 4 5
| for((n=1;n<=${num};n++));do /usr/bin/useradd ${name}${n} echo $pswd |/usr/bin/passwd --stdin $name$n done
|