CentOS Linux release 7.2.1511 (Core)系统获取网卡ip
ifconfig em1|awk ‘NR==2 {print $2}‘
ifconfig em1|sed -n ‘2p‘|cut -d ‘ ‘ -f 10
ifconfig em1|sed -n "s/^.*inet \(.*\) netmask.*$/\1/gp"
grep ‘IPADDR‘ /etc/sysconfig/network-scripts/ifcfg-em1|awk -F ‘=‘ ‘{print $NF}‘
grep ‘IPADDR‘ /etc/sysconfig/network-scripts/ifcfg-em1|awk -F ‘=‘ ‘{print $2}‘
时间: 2024-10-13 14:59:22