Netstat – derived from the words network and statistics – is a command-line utility used by system administrators for analyzing network statistics. It displays a whole manner of statistics such as open ports and corresponding addresses on the host system, routing table, and masquerade connections.
In this article, we will walk you through how you can install netstat command in different Linux distributions.
How to Install netstat Command in Linux
The package that contains netstat is called net-tools. On modern systems, the netstat utility comes pre-installed and there’s no need to install it.
On older systems, however, you are likely to bump into an error when you run the netstat command. Therefore, to install netstat on Linux distributions, run the command.
Once installed, run the command below to check the version of netstat installed.
How to Use netstat Command in Linux
You can invoke the netstat command on any of the Linux distributions to get different statistics on your network.
1. Viewing the Network Routing Table
You use the -r
flag to show the network routing table to get something similar to the output below.
The -n
option forces netstat to print addresses separated by dots instead of using symbolic network names. The option is useful for avoiding address lookups over a network.
2. Display Network Interface Statistics
Use the -i
flag to get an output of statistics of a network interface that is configured. The -a
option prints all present interfaces in the kernel.
3. Show Network Connections
The netstat command utility supports options that display active or passive sockets using the options -t
, -n
, and -a
. The flags show RAW, UDP, TCP, or UNIX connection sockets. Adding the -a
option, it will sow sockets ready for connection.
4. Show Network Services
To list services, their current state, and their corresponding ports, run the command.
In this article, we shed light on how you can install netstat command and how it is used to checking a wide array of network statistics. It’s also important to point out that netstat has been deprecated and instead ss utility has taken its place in displaying more refined network statistics.
Boni yeamin laju
Post a Comment