The sys admin’s daily grind – ifdata Info
Script-friendly ifdata from the Moreutils package delivers absolutely precise network interface status information, with no need to extract individual values.
When I need to know whether a particular interface exists – and, if so, what IP address and MTU it has – my script is inevitably bulky. I then bombard the results of ip addr show eth0, ifconfig, or iwconfig with grep, cut, and regular expressions until the requested information is chiseled out. In contrast, ifdata from the Moreutils package solves my task elegantly. I can use parameters to control the ifdata output so that only the desired result appears, which is ideal for ongoing processing in a script.
Buy this article as PDF