On Tue, Aug 15, 2017 at 03:14:02PM +0100, Darac Marjal wrote: > Have you looked at "ip -s link"? It's not quite as easy to parse as "netstat > -in", but all the information's there.
Actually, "ip -o link" is a step in the right direction: wooledg:~$ ip -o link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1\ link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000\ link/ether a0:8c:fd:c3:89:e0 brd ff:ff:ff:ff:ff:ff Still requires multiple steps to extract the interface names (unless you use awk, or some other language with wide field delimiters), and still not as nice as ps h -o ppid "$pid", but I guess we won't ever get anything nicer. wooledg:~$ ip -o link | awk -F": " '{print $2}' lo eth0 The only other scripting language I know that can do splitting with multi-character separators is perl. wooledg:~$ ip -o link | perl -ne '@x=split(/: /); print $x[1], "\n"' lo eth0 Bash and Tcl can't do it, at least not with their native toolsets. I don't know python or ruby or any others.