# 利?SSH客户端登录 root 账号,查看 /tmp ?录下是否存在??录 myshare,如果没有则建?该?录;
[root@wu1 ~]# mkdir /tmp/myshare
# 在 myshare ?录下创建?个名为“学号”的?件夹和?个名为 exam2.txt 的?件;
[root@wu1 ~]# mkdir /tmp/myshare/201814090518
[root@wu1 ~]# touch /tmp/myshare/201814090518/exam2.txt
# 创建?个名字为 test 的新?户,并指定uid为1024;
[root@wu1 ~]# useradd -u 1024 test
# 把 /etc/passwd 和 /etc/shadow 含有?户 test 信息的 ? 追加到 exam2.txt ?件中;
[root@wu1 ~]# cat /etc/passwd |grep test >> /tmp/myshare/201814090518/exam2.txt
[root@wu1 ~]# cat /etc/shadow |grep test >> /tmp/myshare/201814090518/exam2.txt
# 把 /etc/passwd 前13?的内容 追加到 myshare ?录下 名为 exam2.txt 的?件中;
[root@wu1 ~]# head -n 13 /etc/passwd >> /tmp/myshare/201814090518/exam2.txt
# 把 myshare ?录下的所有?件和??录的内容以?格式的?式追加到 exam2.txt 中;
[root@wu1 ~]# ls -lR /tmp/myshare >> /tmp/myshare/201814090518/exam2.txt
# 把 myshare ?录及其?录下的所有?件和??录的拥有者设置为?户 test ,组改为mail;
[root@wu1 ~]# chown -R test /tmp/myshare
[root@wu1 ~]# chgrp -R mail /tmp/myshare
# 把 myshare ?录下的所有?件和??录的内容以?格式的?式追加到 exam2.txt 中;
[root@wu1 ~]# ls -lR /tmp/myshare >> /tmp/myshare/201814090518/exam2.txt
# 利?su命令切换到?户 test 账号;
[root@wu1 ~]# su test
# 进?/tmp/myshare/“学号”?录,采?vi编辑器编写以下程序,程序名称为hello.sh
[test@wu1 root]$ vi /tmp/myshare/201814090518/hello.sh
# 保存 hello.sh 后,给予 hello.sh 拥有者可读、可写和可执?的权限,同组可读可执?,其他?可执?权限;
[test@wu1 root]$ chmod 751 /tmp/myshare/201814090518/hello.sh
# 以?格式的形式查看 hello.sh 的?件权限信息,并把输出内容追加到 exam2.txt;
[test@wu1 root]$ ll /tmp/myshare/201814090518/hello.sh >> /tmp/myshare/201814090518/exam2.txt
# 输? ./hello.sh 执?脚本,查看输出结果。并把输出结果追加 exam2.txt;
[test@wu1 root]$ /tmp/myshare/201814090518/hello.sh >> /tmp/myshare/201814090518/exam2.txt
# 进??户 test 的?户主?录,在这个?录下创建 hello.sh 的软链接myhello.sh,同时拷? hello.sh 到该?录下并改名为 hello.sh.bak;
[test@wu1 root]$ cd /home/test
[test@wu1 ~]$ ln -s /tmp/myshare/201814090518/hello.sh /home/test/myhello.sh
[test@wu1 ~]$ cp /tmp/myshare/201814090518/hello.sh /home/test/hello.sh.bak
# 以?格式形式查看?户 test 主?录下的所有?件并把结果追加到 exam2.txt中;
[test@wu1 ~]$ ls -lR /home/test >> /tmp/myshare/201814090518/exam2.txt
# 执??户 test 主?录下的myhello.sh?件,查看链接是否正常;
[test@wu1 ~]$ /home/test/myhello.sh
# 退出?户 test 帐号,回到root帐号
[test@wu1 ~]$ su root
# 以?格式形式查看?户 test 主?录下的所有?件(含隐藏?件)并把结果追加到 exam2.txt中;
[root@wu1 test]# ls -lRa /home/test >> /tmp/myshare/201814090518/exam2.txt
# 从 /usr 开始查找后缀名为.conf的所有?件(普通?件),把输出结果追加到 exam2.txt中;
[root@wu1 test]# find /usr -name "*.conf" -type f >> /tmp/myshare/201814090518/exam2.txt
# 从上?步找到的conf?件中找出?件容量最?的?件,并把这个?件以?格式形式追加到exam2.txt 中 ;(倒引号)
[root@wu1 ~]# ls -lSh `find /usr -name "*.conf" -type f` | head -n 1 >> /tmp/myshare/201814090518/exam2.txt
# 统计出系统中有多少个?户帐号,把数量追加到 exam2.txt 中;
[root@wu1 ~]# cat /etc/passwd | wc -l >> /tmp/myshare/201814090518/exam2.txt
# 把 exam2.txt ?件转换为windows格式。
[root@wu1 ~]# unix2dos /tmp/myshare/201814090518/exam2.txt
# 删除?户test 的所有内容(包括主?录)
[root@wu1 ~]# userdel -r test
# 删除/tmp/myshare?录
[root@wu1 ~]# rm -rf /tmp/myshare
想了解更多内容,请访问: 51CTO和华为官方战略合作共建的鸿蒙技术社区 https://...
transition文档地址 定义一个背景弹出层实现淡入淡出效果 template div button @...
本文实例讲述了jsp 实现的简易mvc模式。分享给大家供大家参考,具体如下: jsp :...
IT之家 3月5日消息谷歌 Chrome 浏览器通常每六周收到一次重要功能更新,而谷歌近...
Git 服务器搭建 上一章节中我们远程仓库使用了 Github,Github 公开的项目是免费...
说到Windows系统,但凡用PC设备的人应该都离不开,即便是买入MacBook等苹果电脑...
在JavaScript代码中使用正则表达式进行模式匹配经常会用到String对象和RegExp对...
2月3日消息 微软名为 PowerToys 的免费系统实用工具套件从 Windows XP 时代复活...
idea激活码失效说明 在2020.11.26,idea又迎来了一次大规模的更新,好多小伙伴发...
最近完成了初版的数据逻辑备份恢复的功能,和业务方做了一些交流和演示,发现他...