1、 统计/var/log下文件的个数。
2、如何将F1.txt文件的运行结果输出到F2.txt里?
3、写一个脚本实现判断192.168.1.0/24 网络里,当前在线的ip有哪些,能ping通则认为在哪
4、根据以下信息:
IP_Address MAC_Address Interface Static
10.66.10.250 80:71:7A:33:CA:A7 br on
10.66.10.249 5C:50:15:7F:3B:F5 br on
将以上文件名称test.txt文件中IP_Address,MAC_Address, Interface三项下的内容取出来,值以“:”分割,并呈格式显示出来。注:
10.66.10.250:80:71:7A:33:CA:A7:br
10.66.10.249:5C:50:15:7F:3B:F5:br
5、在shell中变量的赋值有四种方法,其中采用name=oupeng.com的方法称:
直接赋值 使用read命令 使用命令行传参 使用命令输出
6、编写一个脚本,5分钟检查一次日志,发现有暴力SSH破解现象的,提取此类IP地址,并去重,并按降序排序。
要求:同一个IP暴力破解超过10次,自动屏蔽IP地址,指定办公室IP地址(192.168.100.100)为可信任IP地址,不受屏蔽规则限制,以下为日志格式:
日志样式:
May 4 03:43:07 tz-monitor sshd{14003}: Failed password for root from 124.232.135.84 port 25251 ssh2
Myy 4 03:43:07 tz-monitor sshd{14082}: invalid user postgres from 124.232.135.84
7、检查IP地址合规,请用shell编写代码,列出不以199或200开头的IP地址,如199.x.x.x 或200.x.x.x
Interface Physical Protocol IP Adderss
Eth1/0/1 up up 199.11.250.1
Eth1/0/2 up up 200.11.250.5
Loop0 up up(s) 199.11.250.1
Vlan1 *down down unassigned
Vlan500 down down 139.100.1.157
Vlan900 up up 140.11.250.41
8、处理以下文件内容,将域名提取并进行计数排序,如处理:
http://www.baidu.com/index.html
http://www.baidu.com/1.html
http://post.baidu.com/index.html
http://mp3.baidu.com/index.html
http://www.baidu.com/3.html
http://post.baidu.com/2.html
得到如下结果:
域名的出现次数 域名
3 www.baidu.com
2 post.baidu.com
1 mp3.baidu.com
9、在单台服务器Linux操作系统环境下,写一行命令,将所有该机器的所有以“.log.bak“为后缀的文件,打包压缩并上传到ftp上,FTP地址为123.234.25.130的/home/bak文件夹
10、Linux脚本:现在要删除本机中若干文件,/root/file.list中记录了这些文件的绝对路径,请用脚本实现。/root/file.list内容范例:/tmp/1.file