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
获取网络配置信息
本文介绍两种方法来获取系统的网络配置信息,包括英文版和中文版系统下通过命令行获取IP地址的方法,以及使用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

被折叠的 条评论
为什么被折叠?