#!/bin/bash ifconfig|grep -E 'eth|inet'|grep -Ev '(inet6|127.0.0.1)'|sed 's/ /\n/g'|awk NF|grep -Ev '(inet|encap|Link|HWaddr)'|sed 's/00:/MAC:/g';route|grep default|awk '{print "\nGATEWAY:"$2}' cat /etc/resolv.conf|grep nameserver|awk '{print "DNS:"$2}'
原文地址:http://blog.csdn.net/dapeng0112/article/details/39673177