1、打印网络接口列表
[root@localhost touch_more]# ifconfig | cut -c-10 | tr -d ' ' | tr -s '\n'
eth0lo-c-10 ; 输出前10个字符;
-d ' ' ; 删除所有空格;
-s '\n'; 压缩重复的换行符
2、查看名字服务器
[root@localhost touch_more]# cat /etc/resolv.conf
# Generated by NetworkManagerdomain localdomainsearch localdomainnameserver 192.168.119.2
3、DNS查找
[root@localhost touch_more]# nslookup www.csdn.net
Server: 192.168.119.2Address: 192.168.119.2#53Non-authoritative answer:www.csdn.net canonical name = www.csdn.net.aqb.so.Name: www.csdn.net.aqb.soAddress: 14.17.69.22
4、列举出局域网中同一网段的所有的活动主机
[root@localhost program_test]# cat list_active_hosts.sh
#!/bin/bashfor ip in 192.168.119.{1..255} ;
doping $ip -c 2 &> /dev/null;if [ $? -eq 0 ];
thenecho $ip is active!fidone[root@localhost program_test]# ./list_active_hosts.sh 192.168.119.1 is active!192.168.119.2 is active!