ip link show type
ip -details link show
type在第三行, loopback 物理 wifi等没有type
ip -details -json link show | jq --join-output ' .[] | if .ifname != null then .ifname, " ", if .linkinfo.info_kind != null then .linkinfo.info_kind else empty end, " ", if .linkinfo.info_slave_kind != null then .linkinfo.info_slave_kind else empty end, "\n" else empty end '
#!/bin/bash # Arguments: $1: Interface ('grep'-regexp). # For virtual devices, device type is shown on the third line. # Static list of types (from `ip link help`). NOTE: On my machine, not all types are listed there, e.g. the type `tun`. And the list of types may change over time. So do not ultimately rely on this list here!: TYPES=(bareudp bond bond_slave bridge can dummy erspan geneve gre gretap hsr ifb ip6erspan ip6gre ip6gretap ip6tnl ipip ipoib ipvlan ipvtap lowpan macsec macvlan macvtap netdevsim nlmon rmnet sit tap tun vcan veth vlan vrf vti vxcan vxlan xfrm) iface="$1" for type in "${TYPES[@]}"; do ip link show type "${type}" | grep -E '^[0-9]+:' | cut -d ':' -f 2 | sed 's|^[[:space:]]*||' | while read _if; do echo "${_if}:${type}" done | grep "^${iface}" done true
最好脚本
( sudo ip -details -j l | jq -r '.[]|"@", .ifname, .link_type, .linkinfo.info_data.type, .linkinfo.info_kind, .linkinfo.info_slave_kind' | tr '\n' ' ' | tr '@' '\n' ; echo ) | column -t
iproute - iproute2: How to display the TYPE of a network devices? - Unix & Linux Stack Exchange
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
2021-01-08 ssh远程执行nohup命令不退出