How To Check and List Listening Ports with Netstat In Linux

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-check-and-list-listening-ports-with-netstat-in-linux/
PINTEREST
PINTEREST
INSTAGRAM

netstat is very useful tool which provides a lot of information about the network of operating system. netstat command can list ip addreass, route, port, connections etc. More detailed information about the netstat command can be found in the following tutorial.

Linux Netstat Command With Examples

List All Listening Ports

We can use netstat -l options in order to list all listening ports. This will list both TCP and UDP ports with IPv4 and IPv6 . But also Unix domain sockets will be printed in the end of the list after TCP and UDP ports.

List All Listening Ports

List All Listening Ports

List Listening TCP Ports

TCP is reliable protocol which provides non data loss. Applications generally prefers and uses TCP protocol for network connections and data transfer. We can use -t option in order to only list TCP ports.

List Listening TCP Ports

List Listening TCP Ports

List Listening UDP Ports

We have also have the ability to only list UDP ports. We will use -u option in order to only list UDP ports.

List Listening UDP Ports

List Listening UDP Ports

List Established Connections

We can also list only established connections by removing -l option which is used in previous examples. -l was used to list only listening ports.

List Established Connections

List Established Connections

Filter The Port List

Now the most funny part. If we are running netstat in a busy server or system we will get a lot of output. In this situations we should filter printed list. We will use grep command where detailed information can be get from following tutorial.

LEARN MORE  Nmap Host Discovery with Examples

Introduction to Linux Grep Command With Examples

Filter SSH Port

Filter HTTP Port

Filter RDP Port

Filter Telnet Port

Filter Multiple Ports In Single Command

If we need to filter multiple ports in a single command we should use grep or logic. In this example we will filter both ssh and telnet ports in single command.

Filter Multiple Ports In Single Command

Filter Multiple Ports In Single Command

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-check-and-list-listening-ports-with-netstat-in-linux/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)