On Fri, Jan 31, 2020 at 10:25:44AM +0000, Brett Parker wrote:
On 30 Jan 18:07, Adam Bower wrote:
On Thu, Jan 30, 2020 at 05:21:29PM +0000, Chris Green wrote:
You'd think this was easy but although I can find the information easily enough I can't find a concise way of doing it.
ip -o l | grep $(ip -o r | grep def | awk '{print $5}') | awk '{print $17}'
Something like that should do it. Although doesn't work well on systems with bonded network interfaces.
How about...
ip -o link | sed -ne '/state UP/ { s#.*link/ether ##; s# .*$##; p; }'
Look at how many fewer processes that uses to get the same result ;)
Nice one, sed is handy at times isn't it! :-)