Home / Linux / How to Install netstat Command in Linux
How to Install netstat Command in Linux

How to Install netstat Command in Linux

How to Install netstat Command in Linux

Netstat – derived from the phrases community and statistics – is a command-line software utilized by machine directors for inspecting community statistics. It shows a complete approach of statistics reminiscent of open ports and corresponding addresses at the host machine, routing desk, and masquerade connections.

In this text, we will be able to stroll you via how you’ll set up netstat command in other Linux distributions.

How to Install netstat Command in Linux

The package deal that comprises netstat is named net-tools. On fashionable techniques, the netstat software comes pre-installed and there’s no use to set up it.

On older techniques, on the other hand, you’re most likely to stumble upon an error whilst you run the netstat command. Therefore, to set up netstat on Linux distributions, run the command.

# yum set up net-tools     [On CentOS/RHEL]
# apt set up net-tools     [On Debian/Ubuntu]
# zypper set up net-tools  [On OpenSuse]
# pacman -S netstat-nat     [On Arch Linux]

Once put in, run the command beneath to take a look at the model of netstat put in.

# netstat -v

How to Use netstat Command in Linux

You can invoke the netstat command on any of the Linux distributions to get other statistics in your community.

1. Viewing the Network Routing Table

You use the -r flag to display the community routing desk to get one thing an identical to the output beneath.

# netstat -nr
List Network Routing TableList Network Routing Table

List Network Routing Table

The -n possibility forces netstat to print addresses separated via dots as a substitute of the use of symbolic community names. The possibility comes in handy for keeping off deal with lookups over a community.

2. Display Network Interface Statistics

Use the -i flag to get an output of statistics of a community interface this is configured. The -a possibility prints all provide interfaces in the kernel.

# netstat -ai
List Network Interface StatisticsList Network Interface Statistics

List Network Interface Statistics

three. Show Network Connections

The netstat command software helps choices that show energetic or passive sockets the use of the choices -t, -n, and -a. The flags display RAW, UDP, TCP, or UNIX connection sockets. Adding the -a possibility, it’ll sow sockets in a position for connection.

# netstat -ant
List Network ConnectionsList Network Connections

List Network Connections

four. Show Network Services

To listing services and products, their present state, and their corresponding ports, run the command.

# netstat -pnltu
List Network ServicesList Network Services

List Network Services

In this text, we make clear how you’ll set up netstat command and the way it’s used to checking a wide selection of community statistics. It’s additionally essential to indicate that netstat has been deprecated and as a substitute ss software has taken its position in exhibiting extra subtle community statistics.

Check Also

How to Watch TCP and UDP Ports in Real-time

How to Watch TCP and UDP Ports in Real-time

How to Watch TCP and UDP Ports in Real-time In tool phrases, particularly on the …

Leave a Reply

Your email address will not be published. Required fields are marked *


Recent Posts