yum install net-tools # 安装 netstat yum install nc.x86_64 # 安装 nc apt install netcat # 安装 nc # 查看占用端口 netstat -tunlp # tcp6 包含 ipv4? ref: https://unix.stackexchange.com/questions/496137 cat /proc/sys/net/ipv6/bindv6only netstat -i # 网络接口列表 netstat -tunlp | grep ssh # 查找程序 netstat -anp | grep ":80" # 查找端口 netstat -s # 端口统计 netstat -st # tcp 统计 netstat -su # udp 统计 nc -6 -l 80 # 监听/查看 ipv6 80 端口 nc -4 -l 80 # 监听/查看 ipv4 80 端口 nc -l 80 # 监听 nc localhost 80 # 开始聊天 nc -l 80 > /tmp/nc.txt # 接收文件 nc localhost 80 < /tmp/file.txt # 传输文件 nc -zv netnr.com 80 # 扫码端口 nc -zvn 114.114.114.114 53 # 扫描端口,跳过 DNS 解析 nc -uvz 127.0.0.1 323 # udp 端口验证