CentOS: bash: netstat: command not found

Автор: | 20/09/2016

centos-logo-new-4На CentOS 7.2 – ошибка:

# netstat -anp | grep java
bash: netstat: command not found

Ищем:

# yum search netstat
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.besthosting.ua
 * extras: mirror.besthosting.ua
 * updates: mirror.besthosting.ua
============================================================================================================================== Matched: netstat ===============================================================================================================================
dstat.noarch : Versatile resource statistics tool
net-snmp.x86_64 : A collection of SNMP protocol tools and libraries
net-tools.x86_64 : Basic networking tools

Информация о пакете:

# yum info net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.ps.pl
 * extras: centos1.hti.pl
 * updates: centos1.hti.pl
Available Packages
Name        : net-tools
Arch        : x86_64
Version     : 2.0
Release     : 0.17.20131004git.el7
Size        : 304 k
Repo        : base/7/x86_64
Summary     : Basic networking tools
URL         : http://sourceforge.net/projects/net-tools/
License     : GPLv2+
Description : The net-tools package contains basic networking tools,
            : including ifconfig, netstat, route, and others.
            : Most of them are obsolete. For replacement check iproute package.

net-tools в CentOS 7 считается устаревшим, и заменён на iproute2.

Что бы использовать netstat – устанавливаем net-tools вручную:

# yum install net-tools -y

Проверяем:

# netstat -anp | grep 80
tcp        0      0 10.0.2.15:59966         89.1***.***.161:80        TIME_WAIT   -                   
tcp        0      0 10.0.2.15:47374         217.***.***.86:80       TIME_WAIT   -     
...

Готово.