====== Ubuntu - Networking - Get local IP address ====== ip route get 1 | sed 's/^.*src \([^ ]*\).*$/\1/;q' returns: 192.168.1.69 ---- ip route get 1 | awk '{print $7}' returns: 192.168.1.69 ---- ip -4 addr show | awk '{match($0,/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/); ip = substr($0,RSTART,RLENGTH); print ip}' | sed '/^\s*$/d' | grep -v "127.0.0.1" returns: 192.168.1.69 10.0.3.1