IP Address in bash script

In linux you can get all of yours inferfaces IP with something like this:

1
sudo ifconfig  | grep 'inet addr:'| awk -F: '{ print $2}' | awk '{ print $1 }'

For example on my machine this command will output:

192.168.247.101
127.0.0.1
192.168.123.1
172.16.209.1
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.