Timeline for How to find the currently connected network service from the command line?
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
S Dec 9, 2021 at 5:41 | history | edited | Glorfindel♦ | CC BY-SA 4.0 |
add syntax highlighting hints
|
S Dec 9, 2021 at 5:41 | history | suggested | ccpizza | CC BY-SA 4.0 |
add syntax highlighting hints
|
Dec 8, 2021 at 17:19 | review | Suggested edits | |||
S Dec 9, 2021 at 5:41 | |||||
Sep 13, 2021 at 21:28 | comment | added | Chris |
This assumes that network services have the same names as their underlying hardware ports. networksetup -getdnsservers ... takes a network service name, which can sometimes be different than the hardware port passed to it in this script. You can see them all with -listnetworkserviceorder
|
|
May 2, 2017 at 19:37 | history | edited | David Kittell | CC BY-SA 3.0 |
Updated per PeterVP's suggestion
|
May 2, 2017 at 19:32 | comment | added | David Kittell | Great suggestion | |
May 1, 2017 at 16:09 | comment | added | PeterVP |
In my script I've replaced public query with: set public (dig +short myip.opendns.com @resolver1.opendns.com) My reasoning for this is that a dns server (like opendns) is less likely to be down than a website and is faster. And I removed the sleep statement. No need to wait for the dns-server reply. Execution time for my script 177 ms. Yours takes 5.237 seconds, but does more of course. Still a big difference.
|
|
Feb 27, 2017 at 19:28 | review | Late answers | |||
Feb 27, 2017 at 19:29 | |||||
Feb 27, 2017 at 19:08 | review | First posts | |||
Feb 27, 2017 at 21:19 | |||||
Feb 27, 2017 at 19:05 | history | answered | David Kittell | CC BY-SA 3.0 |