netcat是一个用于TCP/UDP连接和监听的linux工具, 主要用于网络传输及调试领域
1.下载源码文件
[stein@localhost soft]$ sudo wget https://jaist.dl.sourceforge.net/project/netcat/netcat/0.7.1/netcat-0.7.1.tar.gz
2.解压
[stein@localhost soft]$ sudo tar -zxvf netcat-0.7.1.tar.gz
3.配置,指定安装目录
[stein@localhost netcat-0.7.1]$ sudo ./configure --prefix=/usr/local/netcat
4.编译、安装
# 这里切换到了root身份
[root@localhost netcat-0.7.1]$ make && make install
5.配置环境变量
[root@localhost netcat-0.7.1]# vim /etc/profile
增加内容:
# set netcat path
export NETCAT_HOME=/usr/local/netcat
export PATH=$PATH:$NETCAT_HOME/bin
6.重新加载环境变量
[root@localhost netcat-0.7.1]# source /etc/profile
7.测试
[root@localhost netcat-0.7.1]# nc --help
GNU netcat 0.7.1, a rewrite of the famous networking tool.
Basic usages:
connect to somewhere: nc [options] hostname port [port] ...