nc [选项] [主机] [端口(s)]shell
-l 开启 listen 模式服务器
-c 执行命令google
nc 与 netcat、ncat 同义。.net
<!-- lang: shell --> $ nc -l 1234 # 服务器 $ nc 127.0.0.1 1234 # 客户端
<!-- lang: shell --> $ nc -z www.baidu.com 80-81
<!-- lang: shell --> $ nc -l 80 -c "nc www.baidu.com 80" # 将发往本机 80 端口的数据转发给 google.com 的 80 端口
文件从 client 传到 server;反过来也能够。code
<!-- lang: shell --> $ nc -l 1234 > filename.out $ nc host.example.com 1234 < filename.in
man ncserver
Forwarding ports using netcatip
8 个实用的 Linux netcat 命令示例 比 man nc 多讲了些不经常使用的参数。it