码迷,mamicode.com
首页 > 系统相关 > 详细

awk查看本机IP+查看本网段mac

时间:2017-04-04 09:37:58      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:arp   conf   centos7.3   one   int   centos   4.0   pre   inet6   

ifconfig | awk ‘/inet addr/‘  | awk ‘!/127.0.0.1/‘ |awk -F ‘:‘ ‘{print $2}‘ |awk ‘{print $1}‘  (#centos6)
ifconfig | awk ‘/inet/‘|awk ‘!/inet6|127.0.0.1/‘|awk ‘{print $2}‘  (#centos7.3)

  

  

 

echo -e `for i in {1..254}; do  ping -W1 -c1 192.168.77.$i ;done` > /dev/null  &&    arp -n | awk ‘/:/‘ | sort -t. -k4 -n
(#循环{a..b}需求bash 4.0+)

 

  

 

awk查看本机IP+查看本网段mac

标签:arp   conf   centos7.3   one   int   centos   4.0   pre   inet6   

原文地址:http://www.cnblogs.com/feral/p/6664246.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!