老李分享:《Linux Shell脚本攻略》 要点(六)上
2015-12-16 16:19
435 查看
老李分享:《Linux Shell脚本攻略》 要点(六)
1、打印网络接口列表[root@localhost touch_more]# ifconfig | cut -c-10 | tr -d ' ' | tr -s '\n'
eth0
lo
//cut -c-10 ; 输出前10个字符;
//tr -d ' ' ; 删除所有空格;
//tr -s '\n'; 压缩重复的换行符
2、查看名字服务器
[root@localhost touch_more]# cat /etc/resolv.conf
# Generated by NetworkManager
domain localdomain
search localdomain
nameserver 192.168.119.2
3、DNS查找
[root@localhost touch_more]# nslookup www.csdn.net
Server: 192.168.119.2
Address: 192.168.119.2#53
Non-authoritative answer:
www.csdn.net canonical name = www.csdn.net.aqb.so.
Name: www.csdn.net.aqb.so
Address: 14.17.69.22
4、列举出局域网中同一网段的所有的活动主机
[root@localhost program_test]# cat list_active_hosts.sh
#!/bin/bashfor ip in 192.168.119.{1..255} ;
do
ping $ip -c 2 &> /dev/null;if [ $? -eq 0 ];
then
echo $ip is active!
fi
done
[root@localhost program_test]# ./list_active_hosts.sh
192.168.119.1 is active!
192.168.119.2 is active!
相关文章推荐
- 老李性能测试分享
- 你想不到:咖啡馆里上工具课
- 移动端自动化测试开课了
- 老李分享:什么是好战略
- 性能调优案例分享:Mysql的cpu过高
- 性能测试分享:性能测试工具开发的案例分享(上)
- 性能测试分享:性能测试工具开发的案例分享(下)
- 性能测试培训:批量执行Jmeter脚本之ant调用 2
- 性能测试培训:分布式测试之jmeter1
- 老李案例分享:MAT分析应用程序服务出现内存溢出过程1
- 老李案例分享:MAT分析应用程序服务出现内存溢出过程2
- 老李案例分享:定位JAVA内存溢出 1
- 老李案例分享:定位JAVA内存溢出 2
- 性能测试培训: 建立压力模型
- 老李分享:你知道有哪些持续集成工具
- 老李分享知识:性能测试之TPS和吞吐率
- 老李分享知识:性能测试之吞吐量
- 性能测试培训:分析内训泄露的案例
- 自动化测试培训:qtp脚本获取获取汇率数据
- 性能测试培训:sql server性能测试分析局部变量的性能影响1