最近, 我在CentOS 7上安装了Nginx Plus, 想验证它是否使用netstat在端口80上侦听。
【故障排除(netstat: command not found)】你猜怎么着?执行netstat时出现以下错误。
[[email
protected] init.d]# netstat -anlp |grep 80-bash: netstat: command not found[[email
protected] init.d]#
解:-
使用yum命令安装net-tools
yum install net-tools
例如:
[[email
protected] init.d]# yum install net-toolsLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile
* base: mirrors.xmission.com
* epel: mirror.hmc.edu
* extras: centos.s.uw.edu
* updates: mirrors.syringanetworks.netResolving Dependencies-->
Running transaction check--->
Package net-tools.x86_64 0:2.0-0.22.20131004git.el7 will be installed-->
Finished Dependency ResolutionDependencies Resolved===============================================================================================================================================================
Package
Arch
Version
Repository
Size===============================================================================================================================================================Installing:
net-tools
x86_64
2.0-0.22.20131004git.el7
base
305 kTransaction Summary===============================================================================================================================================================Install
1 PackageTotal download size: 305 kInstalled size: 917 kIs this ok [y/d/N]: yDownloading packages:net-tools-2.0-0.22.20131004git.el7.x86_64.rpm
| 305 kB
00:00:04
Running transaction checkRunning transaction testTransaction test succeededRunning transaction
Installing : net-tools-2.0-0.22.20131004git.el7.x86_64
1/1
Verifying
: net-tools-2.0-0.22.20131004git.el7.x86_64
1/1
Installed:
net-tools.x86_64 0:2.0-0.22.20131004git.el7
Complete![[email
protected] init.d]#
然后我可以使用netstat。
[[email
protected] init.d]# netstat -anlp |grep 80tcp
0
0 0.0.0.0:80
0.0.0.0:*
LISTEN
1818/nginx: master
[[email
protected] init.d]#
我希望这可以帮助你解决CentOS 7上的netstat not found错误。
推荐阅读
- 如何安装和基本的MySQL命令示例
- telnet无法识别为内部或外部命令-已修复
- 7个适用于小型到大型站点的开源Web服务器
- 如何在RHEL / CentOS 7中启动时自动启动服务()
- 如何在Ubuntu,CentOS上安装Node.js 11()
- Android开发之sqlite数据库的练习
- flutter之配置安卓环境的小坑 but Android SDK not found at this location.
- Android教程2020 - RecyclerView获取滑动距离
- Xamarin Android Activity全屏