Linux解决 -bash: nc: command not found问题

时间:2024-04-15 10:12:22

1 问题

[root@cm ~]# nc -l 9000

-bash: nc: command not found

  提示: 无法使用这个nc命令。因为没有配置这个命令。 

2 解决办法

输入命令: 

[root@hadoop1 ~]# yum install -y nc

运行结果:

[root@cm ~]# yum install -y nc

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: mirrors.163.com

* extras: centos.ustc.edu.cn

* updates: centos.ustc.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package nmap-ncat.x86_64 2:6.40-16.el7 will be installed

--> Processing Dependency: libpcap.so.1()(64bit) for package: 2:nmap-ncat-6.40-16.el7.x86_64

--> Running transaction check

---> Package libpcap.x86_64 14:1.5.3-11.el7 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


===================================================================================================================================

Package Arch Version Repository Size

===================================================================================================================================

Installing:

nmap-ncat x86_64 2:6.40-16.el7 base 206 k

Installing for dependencies:

libpcap x86_64 14:1.5.3-11.el7 base 138 k


Transaction Summary

===================================================================================================================================

Install 1 Package (+1 Dependent package)


Total download size: 344 k

Installed size: 740 k

Downloading packages:

warning: /var/cache/yum/x86_64/7/base/packages/nmap-ncat-6.40-16.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY

Public key for nmap-ncat-6.40-16.el7.x86_64.rpm is not installed

(1/2): nmap-ncat-6.40-16.el7.x86_64.rpm | 206 kB 00:00:00

(2/2): libpcap-1.5.3-11.el7.x86_64.rpm | 138 kB 00:00:00

-----------------------------------------------------------------------------------------------------------------------------------

Total 517 kB/s | 344 kB 00:00:00

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Importing GPG key 0xF4A80EB5:

Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"

Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5

Package : centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)

From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Installing : 14:libpcap-1.5.3-11.el7.x86_64 1/2

Installing : 2:nmap-ncat-6.40-16.el7.x86_64 2/2

Verifying : 14:libpcap-1.5.3-11.el7.x86_64 1/2

Verifying : 2:nmap-ncat-6.40-16.el7.x86_64 2/2


Installed:

nmap-ncat.x86_64 2:6.40-16.el7


Dependency Installed:

libpcap.x86_64 14:1.5.3-11.el7


Complete!