利用shell脚本得到mac地址
来源:互联网 发布:openwrt p2p端口 编辑:程序博客网 时间:2024/04/28 17:20
在linux下,利用shell编程,可以很方便的处理文本或得到系统信息,这里就利用shell编程拿到mac地址,ipv4地址,ipv6地址。
ifconfig | awk '/eth0/{print $NF}'|tr : " "
50 E5 49 32 9D A0
/sbin/ifconfig |sed -ne "/eth0/ s/.*HWaddr \(.*\)/\1/p"|tr : " "
50 E5 49 32 9D A0
ifconfig | grep eth0 | awk '{print $5}' | awk -F: '{print $1 $2 $3 $4 $5 $6}'
50E549329DA0
ifconfig | grep eth0|cut -d':' -f2-7|cut -d '' -f4 | awk '{print $3}'
50:E5:49:32:9D:A0
ifconfig | grep -A 4 eth0 | awk '/inet\ addr/{print $2}' | awk -F: '{print $2}
192.168.1.4 eth0 ip addr
ifconfig | grep -A 4 eth0 | awk '/inet6\ addr/{print $3}' | awk -F/ '{print $1}'
fe80::52e5:49ff:fe32:9da0 ipv6 addr
这里主要利用awk,sed,cut等命令来实现,以后会逐个进行举例说明。
0 0
- 利用shell脚本得到mac地址
- 利用shell脚本得到mac地址
- 通过 MAC 地址得到IP的脚本
- 利用pypthon得到IP和MAC地址
- Java得到mac地址
- delphi得到MAC地址
- 如何得到mac地址
- 在shell脚本中进行MAC地址的加减
- 利用mac的launchd,开机后定时启动shell脚本
- .Net 如何得到Mac地址
- 得到网卡编号(MAC地址)
- 得到本机mac地址
- 得到本MAC、IP地址
- 正确的得到Mac地址
- Shell脚本得到上一个工作日
- shell获取mac地址
- Mac shell 脚本 笔记
- shell脚本教程地址
- ORA-01940:无法删除当前已链接的用户
- 腾讯Bugly的前世今生
- ImageDib类
- 简单总结一下计算机科学(CS)的课程体系
- 20141204-OrCAD capture图标变小的解决办法
- 利用shell脚本得到mac地址
- Yii 用户登录验证
- MySQL 查询 -- 表连接
- 指针的基本操作 (new-delete)输出最值
- 云络结合Docker和OpsWorks,在AWS平台发布了全自动DevOps系统
- 15周(oj)
- Linux根目录下主要目录功能说明及挂载点介绍
- Mat像素操作
- CryENGINE3初探Flowgraph(FG)(三)----使用C++创建自定义Node