五、文本处理工具和正则表达式
1、基本正则表达式(53分钟)
2、基本正则表达式和扩展正则表达式(50分钟)
3、文本处理三剑客之grep(43分钟)
4、shell脚本编程基础知识(14分钟)
5、shell脚本编程基础(48分钟)
6、shell脚本编程关于变量(62分钟)
7、shell脚本编程特殊变量和脚本安全(42分钟)
8、shell脚本编程算术运算(48分钟)
第六天
六、文本处理和shell编程基础
1、shell脚本编程逻辑运算和条件测试(55分钟)
2、shell脚本编程条件判断和条件组合(53分钟)
3、shell脚本编程条件判断If和case(52分钟)
4、shell脚本编程for循环(57分钟)
5、yum的私有仓库和内核升级(52分钟)
6、文件打包和压缩(48分钟)
6、文件打包和压缩(59分钟)
第三周
1、统计出/etc/passwd文件中其默认shell为非/sbin/nologin的用户个数,并将用户都显示出来 注:grep nologin

 1 [root@centos8 ~]#grep -v '/sbin/nologin' /etc/passwd | wc-l
2 bash: wc-l: command not found...
3 [root@centos8 ~]#grep -v '/sbin/nologin' /etc/passwd | wc -l
4 9
5 [root@centos8 ~]#grep -v '/sbin/nologin' /etc/passwd | cut -d: -f1
6 root
7 sync
8 shutdown
9 halt
10 brucelebron
11 mageia
12 user1
13 user2
14 user3
15 [root@centos8 ~]#

2、查出用户UID最大值的用户名、UID及shell类型

1 [root@centos8 ~]#getent passwd | sort -t: -k3 -n |tail -1 | cut -d: -f1,3,7
2 nobody:65534:/sbin/nologin

3、统计当前连接本机的每个远程主机IP的连接数,并按从大到小排序

1 [root@centos8 ~]#ss  -nt | grep -v '^State' | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}:[0-9]+ *$' |grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' |sort | uniq -c
2 2 10.0.0.1
3 1 8.43.85.13

4、编写脚本disk.sh,显示当前硬盘分区中空间利用率最大的值

[root@centos8 ~]#cat disk.sh
df | tail -n +2 |tr -s ' ' |cut -d" " -f5 | tr -d % |sort -nr |head -1
[root@centos8 ~]#bash disk.sh
28

  

5、编写脚本 systeminfo.sh,显示当前主机系统信息,包括:主机名,IPv4地址,操作系统版本,内核版本,CPU型号,内存大小,硬盘大小

#!/bin/bash
RED="\E[1;31m"
GREEN="\E[1;32m"
END="\E[0m"
echo -e "$GREEN----------------------Host systeminfo--------------------$END"
echo -e "HOSTNAME: $RED`hostname` $END"
echo -e "IPADDR: $RED`ifconfig ens160 | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -n1`$END"
echo -e "OSVERSION: $RED`cat /etc/redhat-release`$END"
echo -e "KERNEL: $RED`uname -r`$END"
echo -e "CPU: $RED`lscpu|lscpu | grep -m1 'Model name' |tr ‘ ’ |cut -d: -f2`$END"
echo -e "MEMORY: $RED`free -h|grep Mem|tr -s ' ' : |cut -d : -f2`$END"
echo -e "DISK: $RED`lsblk |tr -s ' ' | cut -d " " -f4 |tail -n +3|head -n1`$END"
echo -e "$GREEN---------------------------------------------------------$END"

  

 1 [root@centos8 ~]#./systeminfo.sh
2 ----------------------Host systeminfo--------------------
3 HOSTNAME: centos8.mage.edu
4 IPADDR: 10.0.0.150
5 OSVERSION: CentOS Linux release 8.5.2111
6 KERNEL: 4.18.0-348.7.1.el8_5.x86_64
7 CPU: Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz
8 MEMORY: 1.9Gi
9 DISK: 200G
10 ---------------------------------------------------------

6、20分钟内通关vimtutor(可参考https://yyqing.me/post/2017/2017-02-22-vimtutor-chinese-summary)

最新文章

  1. REGEX例子
  2. 谈c++ pb_ds库(二) 红黑树大法好
  3. Synchronized快
  4. 简单的JPA注解例子
  5. POJ3613 Cow Relays(矩阵快速幂)
  6. maven-dependency-plugin插件的使用
  7. MyEclipse取消验证Js的两种方法
  8. Java邮件服务学习之五:邮箱服务服务端 Apache
  9. 七牛云- Java 端 使用
  10. asp.net微信开发第七篇----高级群发(图文)
  11. WinXP 无线提示“区域中找不到无线网络”的一种可能原因!
  12. IOS 类似于网易新闻首页新闻轮播的组件
  13. 2. 网友对app后端写作系列文章的写作建议
  14. Selenium+PyCharm环境搭建
  15. 【转】Eclipse 乱码 解决方案总结(UTF8 -- GBK)
  16. 【Excel】读取CSV文本
  17. php取余运算(%) 注意事项
  18. mac上配置java开发环境
  19. Mybatis学习4——核心文件sqlMapperConfig.xml属性
  20. fedora25的nfs文件系统搭建

热门文章

  1. 关于jQuery的操作
  2. GitHub车牌检测识别项目调研
  3. lwl-resume 个人简历编辑使用说明
  4. 数据库实践丨使用MTK迁移Mysql源库后主键自增列导致数据无法插入问题
  5. 模板层语法、模板层之标签、模板的继承与导入、模型层之ORM常见关键字
  6. shell基础命令知识持续更新
  7. 线上排查:内存异常使用导致full gc频繁
  8. python学习第八周总结
  9. Educational Codeforces Round 143 (Rated for Div. 2) A-E
  10. NETAPP FAS2720初始化配置