1、英文版系统
ifconfig eth0|grep 'inet addr'| awk '{print ($2)}'|awk -F: '{print ($2)}'
2、中文版系统
ifconfig eth0|grep 'inet 地址'| awk '{print ($2)}'|awk -F: '{print ($2)}'
3、第二种方法
hostname
1、英文版系统
ifconfig eth0|grep 'inet addr'| awk '{print ($2)}'|awk -F: '{print ($2)}'
2、中文版系统
ifconfig eth0|grep 'inet 地址'| awk '{print ($2)}'|awk -F: '{print ($2)}'
3、第二种方法
hostname