Timeline for Retrieve name of the active network interface only
Current License: CC BY-SA 3.0
14 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 23, 2018 at 12:35 | comment | added | terdon♦ |
@harperville that just means "if this line contains the string inet and then brd, print the last field". In awk, the variable NF is the number of fields, so $NF is the last field.
|
|
| Oct 23, 2018 at 12:28 | comment | added | harperville |
@terdon do you mind explaining what's going on in the awk statement? You specifically mentioned what exit does but how does the /init.*brd/{print $NF} part even work? Thanks!
|
|
| Mar 16, 2016 at 5:23 | history | edited | G-Man Says 'Reinstate Monica' | CC BY-SA 3.0 |
Highlighted keywords in wall of text; explained command.
|
| Mar 15, 2016 at 23:06 | comment | added | cas | BTW, us sysadmin types are good at thinking of ways that apparently simple and obvious solutions might fail or just be inadequate as a generic solution :) | |
| Mar 15, 2016 at 23:06 | comment | added | cas |
i don't think there is an answer that isn't specific to the machine and especially to the user's requirements - what's the most important single active interface on any given machine? on my machine, it could be either br0 or ppp0 depending on whether i want to know about LAN or internet link (which is also dependent on eth1 because that's what my bridged-mode ADSL2 modem is connected to...and it will be eth1 when/if i get FTTP) and ALL of these interfaces (and more) are active at the same time on my machine. On yours it's wlp3s0b1 or maybe en0 if your ethernet is plugged in
|
|
| Mar 15, 2016 at 22:59 | history | edited | terdon♦ | CC BY-SA 3.0 |
added 4 characters in body
|
| Mar 15, 2016 at 22:57 | comment | added | terdon♦ | @cas ah. Damn. I haven't used one of those in a long time. Care to post an answer? I'm sure you sysadmin types have a good way of doing this. | |
| Mar 15, 2016 at 22:49 | comment | added | cas | not every "active" interface has a broadcast address - e.g. ppp interfaces don't. | |
| Mar 15, 2016 at 18:24 | vote | accept | aurelien | ||
| Mar 15, 2016 at 18:24 | comment | added | aurelien | Your command just do exactly what I have request for ... So I can just says thanks and accept it :-) | |
| Mar 15, 2016 at 18:22 | comment | added | terdon♦ | @aurelien no worries. I just mentioned it because you're new and might not know how the site works. Feel free to not accept and wait for another answer too, if you prefer. | |
| Mar 15, 2016 at 18:21 | comment | added | aurelien | I will do ... it says to wait 7 minutes :-/ | |
| Mar 15, 2016 at 18:18 | comment | added | terdon♦ | @aurelien If this answer solved your issue, please take a moment and accept it by clicking on the check mark to the left. That will mark the question as answered and is the way thanks are expressed on the Stack Exchange sites. | |
| Mar 15, 2016 at 18:16 | history | answered | terdon♦ | CC BY-SA 3.0 |