JSON addr to jq
Machine-readable interface dump; list UP links with their local IPs
ip -j a | jq -r '.[] | select(.operstate=="UP") | .ifname + " " + (.addr_info[]?.local // "-")'
- tool
- iproute212 commands
More iproute2 commands
-
ip route get <ip>Show the exact route, src IP and oif the kernel picks for a destination
-
ip rule add from <ip> table 100 && ip route add default via 192.168.1.1 dev <name> table 100Route by source IP via a separate table; check with ip rule show
-
ip netns add test && ip netns exec test ip -br aCreate an isolated network namespace and run commands inside it
-
tc qdisc add dev <name> root netem delay 100ms loss 1% && tc -s qdisc show dev <name>Simulate WAN latency/packet loss for testing; remove with tc qdisc del
-
tc qdisc del dev <name> rootDrop the root qdisc to restore normal traffic after netem testing