shell中获取本机ip地址
发布时间:2020-12-15 23:22:43 所属栏目:安全 来源:网络整理
导读:方法一: /sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk ‘{print $2}‘|tr -d "addr:" or /sbin/ifconfig |sed -n ‘/inet addr/s/^[^:]*:([0-9.]{7,15}) .*/1/p‘ ? 方法二: ? local_host="`hostname --fqdn`" local_ip=`host $
方法一: /sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk ‘{print $2}‘|tr -d "addr:" or /sbin/ifconfig|sed -n ‘/inet addr/s/^[^:]*:([0-9.]{7,15}) .*/1/p‘ ? 方法二:? local_host="`hostname --fqdn`" local_ip=`host $local_host?2>/dev/null?| awk ‘{print $NF}‘` ? 方法三: local_host="`hostname --fqdn`" nslookup -sil $local_host?2>/dev/null?| grep Address: | sed ‘1d‘ | sed ‘s/Address://g‘ ? https://www.cnblogs.com/starspace/archive/2009/02/13/1390062.html (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 《数据结构》实验一:VC编程工具的灵活使用心得
- angular2 / RxJS – 如何从subscribe()内部重试
- 验证 – Angular2 / material 2:当以编程方式更改值时,md-
- 如何用bash生产笛卡尔产品?
- scala – 如何在ByteString中获取迭代器的当前位置?
- Scala远程演员 – 陷阱
- 使用node-ipc和unix套接字在NodeJS和C之间进行通信
- 错误:@ angular / material / material没有导出成员’MdBu
- 项目实践系列springfeel(2)
- Laravel源码入门-启动引导过程(六)LoadEnvironmentVaria