1. 程式人生 > >Linux下獲取IP、MAC、掩碼的shell指令碼

Linux下獲取IP、MAC、掩碼的shell指令碼

Mask:ifconfig |grep inet| sed -n '1p'|awk '{print $4}'|awk -F ':' '{print $2}'
IP:ifconfig |grep inet| sed -n '1p'|awk '{print $2}'|awk -F ':' '{print $2}'
mac:ifconfig |grep eth0|awk '{print $5}'


cat /etc/resolv.conf | awk '{print $2}'

route -n | grep eth0 | grep UG | awk '{print $2}'

轉載自:http://www.cnblogs.com/huxingkeji/p/3595715.html