![取IP的几个方法 取IP的几个方法](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
ifconfig eth0|grep " inet add"|cut -d":" -f2|cut -d " " -f1 ifconfig eth0|grep " inet add"|awk -F":" '{print $2}'|awk -F " " '{print $1}' ifconfig eth0|awk -F "[:B]" 'NR==2{print $2}' ifconfig eth0|sed -n '/inet addr/p'|sed 's#.*addr:##g'|sed 's# Bc.*$##g' ifconfig eth0|sed -n 's#^.*addr:\(.*\) Bca.*$#\1#gp'