hostname -I spamming more than one IP address
hostname -I
is synonymous to hostname --all-ip-addresses
which means it will show all IP address of all interfaces (except loopback).
In my computer, i have three configured interfaces (one is my physical (bridge) interface, one virtual interface for lxc
and one virtual interface for docker
), hence it shows:
% hostname -I
10.0.3.1 172.17.42.1 192.168.6.4
From man hostname
:
-I, --all-ip-addresses Display all network addresses of the host. This option enumerates all configured addresses on all network interfaces. The loopback interface and IPv6 link-local addresses are omitted. Contrary to option -i, this option does not depend on name resolution. Do not make any assumptions about the order of the output.