I am trying to write a bash script to get all IP addresses on a server. The script should work on all major distros. Here is what I have:
bash
ifconf
Simply using hostname you can get a list of all your IP addresses, using the -I flag.
-I
i.e.
$ hostname --all-ip-addresses || hostname -I 10.10.85.100 10.20.85.100 10.30.85.100
whereas
$ hostname --ip-address || hostname -i ::1%1 127.0.0.1
Centos7 (k3.10.0)