linux快速查看网卡配置信息以及IP地址
2013-07-05 14:50
337 查看
linux快速查看网卡配置信息以及IP地址。具体代码如下:
#!/bin/bash function err(){ if [ $? == 1 ];then echo " **" fi } if [ $# -eq 0 ]; then defnet="wlan0" else defnet=$@ fi for i in $defnet do echo -e "\033[42;37;5m $i info: \033[0m" echo -n "IPv4 address: " ifconfig $i 2>/dev/null| egrep -o "inet addr:[^ ]*" | grep -o "[0-9.]*" err echo -n "IPv6 address: " ifconfig $i 2>/dev/null| egrep -o "inet6 addr: [^ ]*" | cut -d " " -f 3| grep -o "[a-z0-9:/]*" err echo -n "MAC address: " ifconfig $i 2>/dev/null| egrep -o "addr .*" | grep -o "[A-Z0-9:]*" err echo -n "subnet Mask: " ifconfig $i 2>/dev/null| egrep -o "Mask:.*" | grep -o "[0-9.]*" err echo -n "Broadcast: " ifconfig $i 2>/dev/null| egrep -o "Bcast:[^ ]*" | grep -o "[0-9.]*" err echo -n "Receive Bytes: " ifconfig $i 2>/dev/null| egrep -o '\([^()]*\)'|head -1 err echo -n "Send Bytes: " ifconfig $i 2>/dev/null| egrep -o '\([^()]*\)'|tail -1 err echo -e "\033[44;37;5m $i Extra information:\033[0m" echo -n "外部IP: " curl ifconfig.me err echo -e done exit
相关文章推荐
- Linux系统查看服务器型号、CPU、RAM、ROM以及网卡信息
- linux下如何用命令配置网卡、dns、网关、如何查看网卡状态、如何查看网卡信息。
- shell脚本实现Linux ip的配置(增删改查)以及相关信息查看
- Linux环境下查看服务器硬件配置信息以及服务占用资源命令
- linux下如何用命令配置网卡、dns、网关、如何查看网卡状态、如何查看网卡信息。
- 配置Linux的eth0网卡设置IP地址以及启动方式
- Linux下查看CPU配置信息
- 如何查看Linux 硬件配置信息
- 如何查看LINUX 硬件配置信息
- C++ 中通过GetAdaptersInfo获取网卡配置和Ip地址信息
- Linux 用户和用户组,以及目录或文件的权限配置信息
- Linux查看CPU和内存的配置信息
- linux查看网卡信息
- 在linux纯命令下如何去配置网卡信息
- 查看linux服务器的硬件配置信息
- C++ 中通过GetAdaptersInfo获取网卡配置和Ip地址信息
- Linux下如何查看计算机的配置信息(cpu物理个数、几核)
- Linux查看和改变网卡的一些信息
- linux如何查看CPU,内存,机器型号,网卡信息
- Linux 网卡的IP地址配置