`
haojinghua
  • 浏览: 52100 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

通过shell获取主机IP地址

 
阅读更多

1。IPV4的

[root@slave3 bin]# ifconfig -a|awk '/(cast)/ {print $2}'|cut -d':' -f2|head -1
192.168.1.126

2.IPV6的:

[root@slave3 bin]# ifconfig -a|egrep 'inet6 addr:|address: '|cut -d':' -f2-|cut -d'/' -f1|head -1|tr -d ' '
fe80::6ef0:49ff:fe0e:fbd2

  • 大小: 32.9 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics