On Sun, Oct 20, 2024 at 08:38:45 +0100, Chris Green wrote:
> Yes, but the output from 'ip link show' wraps a whole lot of other
> junk around the MAC address which I'd need to remove for the
> application I want it for.

ip -brief link show

You can also combine -brief with -json if you'd like to use jq(1) or
some other JSON parser to grab the specific field you want.

Without -json, the -brief format is easily parsed by shell commands.
For example,

hobbit:~$ ip -brief link | awk '$2 == "UP" {print $3}'
d0:ad:08:23:8b:79

Reply via email to