Posts Bash Get Ip address?
Post
Cancel

Bash Get Ip address?

Get Ip Address

만약 ethernet interface가 eth0 인 경우

1
2
3
$ IPADDR=$(ifconfig eth0|grep inet|head -1|sed 's/\:/ /'|awk '{print $2}')
$ echo $IPADDR
172.17.0.3

Appendix. References

This post is licensed under CC BY 4.0 by the author.