1、安裝 nc
# yum install nc -y
2、下載文件
// 在 45.77.17.128 這台主機監聽 9988 端口(注意符號是 "<" ) # nc -l 9988 < Python-3.6.6.tar.xz // 在 192.168.1.254 這台主機下載文件(注意符號是 ">" ) # nc --recv-only 45.77.17.128 9988 > Python-3.6.6.tar.xz
3、上傳文件
// 在 45.77.17.128 這台主機監聽 9988 端口(注意符號是 ">" ) # nc -l 9988 > command.tar.gz // 在 192.168.1.254 這台主機上傳文件(注意符號是 "<" ) # nc --send-only 45.77.17.128 9988 < command.tar.gz
如果提示 Ncat: socket: Address family not supported by protocol QUITTING.
使用ipv4, 默認會使用v4 v6, 如果v6禁用了,就會出現這個錯誤
nc -l4 8080