Sunday, 24 November 2019

How to resolve “-bash: netstat: command not found” on CentOS 8

By default netstat command is not available in CentOS8 minimal installation and other Linux distributions. netstat command is available by installing package net-tools. ss command can be used instead of netstat command to check listening ports and services on CentOS8 minimal installation.
This article describes How to resolve “-bash: netstat: command not found” on CentOS8.

[root@linuxcnf ~]# netstat -tulnp|grep 22
-bash: netstat: command not found
[root@linuxcnf ~]#

Step 1. Package Installation: Run the following command to install net-tools package:

[root@linuxcnf ~]# dnf install net-tools
CentOS-8 – AppStream

[root@linuxcnf ~]#

Step 2. Verification: Verify the installation: Run the following commands to verify the installation:

[root@linuxcnf ~]# which netstat
[root@linuxcnf ~]#

[root@linuxcnf ~]# netstat -tulnp|grep 22
tcp        0      0    *               LISTEN      733/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      733/sshd
[root@linuxcnf ~]#

Done!!! Now the netstat command is available in the system.

No comments:

Post a comment