第4周

1、统计出/etc/passwd文件中其默认shell为非/sbin/nologin的用户个数,并将用户都显示出来。
cat /etc/passwd |grep -c "/sbin/nologin";cat /etc/passwd |grep "/sbin/nologin" |cut -d: -f1

2、查出用户UID最大值的用户名、UID及shell类型。
cut -d: -f1,3,7 /etc/passwd |sort -t: -k2 -nr |head -1

3、统计当前连接本机的每个远程主机IP 的连接数,并按从大到小排序。
netstat -t |grep :ssh |cut -d: -f2 |tr -s ' ' |cut -d' ' -f2 |sort -n |uniq -c

4、编写脚本createuser.sh,实现如下功能:使用一个用户名做为参数,如果 指定参数的用户存在,就显示其存在,否则添加之:显示添加的用户的id号等 信息。
第4周

5、编写生成脚本基本格式的脚本,包括作者,联系方式,版本,时间,描述等。

猜你喜欢

转载自blog.51cto.com/14885549/2532094