Linux下提取IP至文件

ifconfig | grep 'inet[^6]' | sed 's/^s*//g' | cut -d ' ' -f2 > ips.txt

 排除127开头的IP:

ifconfig | grep 'inet[^6]' | sed 's/^s*//g' | cut -d ' ' -f2 | sed '/^127.*/d' > ips.txt
原文地址:https://www.cnblogs.com/flowjacky/p/4368169.html