English English French French Spanish Spanish German German
Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
Share on:

Troubleshooting: CentOS 7 – netstat command not found

centos
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

Lately, I was installing Nginx Plus on CentOS 7 and wanted to verify if it’s listening on port 80 using netstat or not.

Guess what? I got the below error while executing netstat.

[root@instance-1 init.d]# netstat -anlp |grep 80
-bash: netstat: command not found
[root@instance-1 init.d]#

Solution:- 

Install net-tools using yum command

 yum install net-tools

Ex:

[root@instance-1 init.d]# yum install net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.xmission.com
 * epel: mirror.hmc.edu
 * extras: centos.s.uw.edu
 * updates: mirrors.syringanetworks.net
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.22.20131004git.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================
 Package                             Arch                             Version                                             Repository                      Size
===============================================================================================================================================================
Installing:
 net-tools                           x86_64                           2.0-0.22.20131004git.el7                            base                           305 k
Transaction Summary
===============================================================================================================================================================
Install  1 Package
Total download size: 305 k
Installed size: 917 k
Is this ok [y/d/N]: y
Downloading packages:
net-tools-2.0-0.22.20131004git.el7.x86_64.rpm                                                                                           | 305 kB  00:00:04     
Running transaction check
Running transaction test
Transaction test succeeded
Running 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!
[root@instance-1 init.d]#

and then I was able to use netstat.

[root@instance-1 init.d]# netstat -anlp |grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1818/nginx: master  
[root@instance-1 init.d]#

I hope this helps you in troubleshooting netstat not found error on CentOS 7.

Thanks to our Sponsors
More great readings on Linux
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • Semrush is an all-in-one digital marketing solution with more than 50 tools in SEO, social media, and content marketing.
    Try Semrush
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder