Skip to content

Instantly share code, notes, and snippets.

@jimathyp
Last active June 4, 2021 20:30
Show Gist options
  • Select an option

  • Save jimathyp/bca6f49ff40a18f93d155fb2ad21b1db to your computer and use it in GitHub Desktop.

Select an option

Save jimathyp/bca6f49ff40a18f93d155fb2ad21b1db to your computer and use it in GitHub Desktop.

IP of the virtual WSL ethernet interface

(actually the CIDR without the mask)

ip addr show eth0 | grep -oP '(?<=inets)d+(.d+){3}'

  1. get interface

    route ls /sys/class/net

    ip addr list

  2. then get ip, eg if interface is eth0

    ip addr show eth0 | grep -oP '(?<=inets)d+(.d+){3}' ip addr show enp62s0u1 | grep inet | awk '{print $2}' | sed 's//[0-9]+//' ip addr show enp62s0u1 | grep inet6 | awk '{print $2}' | sed 's//[0-9]+//'

dig

dig $(hostname).localdomain +short)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment