Bash ip addresses
Jump to navigation
Jump to search
Interesting bash commands working with IP Addresses
Get routable IP address
So far this seems both the simplest and most straightforward way to reliably get our IP address..
chubbard@kvm03:~$ ip route get 1.2.3.4 | awk '{print $7}' 192.168.15.107 Details without awk: chubbard@kvm03:~$ ip route get 1.2.3.4 1.2.3.4 via 192.168.15.1 dev enp2s0f0 src 192.168.15.107 uid 1000 cache