Open3
ip a コマンドのレシピ

Linux なら ip
コマンドだよな?!

今のLANのIPアドレスが知りたい
ip a show scope global up
見やすくしたい
-o
を使おう
ip -o a show scope global up
refs:
さらに抽出したい
ip -o a show scope global up | grep -oP '(?<=inet )\S+'
refs:

regex はいやだ
JSON でアクセスできる
ip --json a show scope global dynamic up | jq -r '.[]|.addr_info[]|select(.family=="inet")|.local'