Linux 中的nc命令小结

2019-09-23 09:12:04丽君

           [-x proxy_address[:port]] [hostname] [port[s]]

讲查看man文档,可见在这个版本中,-l是不能与-s、-p、-z一起使用的,-w参数也会被忽略,所以,正确的用法是:

[root@ftpserver tmp]# nc -l 1234

四、用在脚本中

nc每次启动监听后,都会在客户端连接完成并退出的同时,服务端一同退出。所以,如果需要不断的使用nc进行数据传输,需要在脚本中使用循环。利用nc实现更多的功能,可参考其rpm提供的参考脚本:

引用# rpm -qd nc

/usr/share/doc/nc-1.10/Changelog
/usr/share/doc/nc-1.10/README
/usr/share/doc/nc-1.10/scripts/README
/usr/share/doc/nc-1.10/scripts/alta
/usr/share/doc/nc-1.10/scripts/bsh
/usr/share/doc/nc-1.10/scripts/dist.sh
/usr/share/doc/nc-1.10/scripts/irc
/usr/share/doc/nc-1.10/scripts/iscan
/usr/share/doc/nc-1.10/scripts/ncp
/usr/share/doc/nc-1.10/scripts/probe
/usr/share/doc/nc-1.10/scripts/web
/usr/share/doc/nc-1.10/scripts/webrelay
/usr/share/doc/nc-1.10/scripts/websearch
/usr/share/man/man1/nc.1.gz