1.
[root@bogon ~]# useradd cheng
[root@bogon ~]# passwd cheng
123456ma
[root@bogon ~]# su cheng
[cheng@bogon root]$ who
[cheng@bogon root]$ ps -a
2.
[root@bogon ~]# touch home
[root@bogon home]# touch cheng
[root@bogon home]# cd cheng
[root@bogon cheng]# mkdir back
[root@bogon cheng]# cd back
[root@bogon back]# touch test{1,2}
3.
[root@bogon cheng]# find -type f|wc -l
4.
[root@bogon ~]# useradd zheng
123456deng
[root@bogon ~]# passwd zheng
[root@bogon ~]# passwd -l jf10
[root@bogon ~]# userdel cheng
5.
[root@bogon home]# ls -a
[root@bogon home]# rm -fr .profile
6.
#!/bin/sh #(1)告诉系统其后路径所指定的程序即是解释此脚本文件的 Shell 程序。
DIRNAME=`ls /root | grep bak` #(2)定义一个命令匹配bak文件
if [ -z "$DIRNAME" ] #(3)如果没有则进行创建
then
mkdir /root/bak #(4)则进行创建
cd /root/bak #(5)则进行创建
fi
YY=`date +%y` #(6)年
MM=`date +%m` #(7)月
DD=`date +%d` #(8)日
BACKETC=$YY$MM$DD_etc.tar.gz #(9) 以时间 打包 #(5)
tar zcvf $BACKETC /etc #(10) #(6)
echo "fileback finished!" #(11)输出
7.
#!/bin/bash
groupadd class1
for ((i=1;i<=30;i++))
do
if [ $i -lt 10 ];then
username="class0"$i
else
username="class"$i
fi
useradd -G class1 $username
done
8.
#!/bin/ksh
count = 0
read num
min=$num
max=$num
sum=0
while read num; do
sum=`expr $sum + $num`
if [[ $num -gt $max ]]; then
max=$num
fi
if [[ $num -lt $min ]]; then
min=$num
fi
if [[ $count -eq 100 ]]; then
exit
else
count=`expr $count + 1`
done
echo "Max: $max"
echo "Min: $min"
echo "Sum: $sum"
exit 0
9.
[root@bogon home]# touch temp
[root@bogon home]# crontab -u root -e
*/30 * * * * tar zcf /home/zheng.tar.gz /home/temp
[root@bogon home]# at now +1 minutes
at> mkdir /home/temp
at> tar -czvf
at> tar -czvf /home/temp/stu.tar.gz /home/stu/*
at> <EOT> #ctr+D执行
job 1 at 2018-05-24 20:13
You have new mail in /var/spool/mail/root
[root@bogon home]# ls