從 ifconfig 中得到 IP地址
来源:互联网 发布:知乎 巴黎观光巴士 编辑:程序博客网 时间:2024/05/03 09:46
我们知道使用 ifconfig -a 就能得到所有网络界面的 IP 地址,不过这些 IP 地址都混在其他信息之中。
你需要从中分离出来,下面的脚本就能帮助你直接输出 IP 地址:
ifconfig | awk ’/inet/{print $2}’ | awk -F: ’{print $2}’
root@desktop:~/bash# ifconfig | awk '/inet/ {print $2}' | awk -F: '{print $2}' | grep -m1 .
10.10.9.121
man grep
-m NUM, --max-count=NUM
Stop reading a file after NUM matching lines. If the input is standard input
from a regular file, and NUM matching lines are output, grep ensures that the
standard input is positioned to just after the last matching line before exiting,
regardless of the presence of trailing context lines. This enables a calling
process to resume a search. When grep stops after NUM matching lines, it outputs
any trailing context lines. When the -c or --count option is also used, grep
does not output a count greater than NUM. When the -v or --invert-match option
is also used, grep stops after outputting NUM non-matching lines.
- 從 ifconfig 中得到 IP地址
- ifconfig查看IP地址
- 在linux中使用ifconfig不能查看ip地址
- Linux中ifconfig命令不显示IP地址
- 虚拟机ifconfig只能得到lo,得不到eth0。ip地址为空
- ifconfig 截取ip地址 -linux
- jsp中得到客户端真实ip地址
- jsp中得到客户端真实ip地址
- 第一次得到IP地址.
- 得到IP地址
- 得到本地IP地址
- 得到客户端IP地址
- 从数据库中得到IP地址,在DataGridView中排序
- ifconfig eth0输出里没有IP地址
- Linux下ifconfig配置IP地址
- ifconfig 正则表达式过滤ip地址
- linux ifconfig命令配置ip地址
- ifconfig命令,不显示IP地址
- 动态调用dll
- 随机取oracle表中数据的解决办法~
- 关于xml 和 html 的转义字符
- 利用php中的eval来模拟java中的动态代理
- 备份操作 图解地址!
- 從 ifconfig 中得到 IP地址
- c连接符
- C# Windows Mobile 利用Com 透明图片绘制
- C语言宏定义##连接符和#符的使用
- Linux技巧:Linux系统下批量替换文件内容
- GEF 学习系列之六:图元的选择框和反馈显示
- 迟到千年
- 删除3天前的文件
- QA List