Advance

ss Command Examples To Monitor Network Connections

ss Command Examples to Monitor Network Connections
0
(0)

[Updated] A Linux system administrator needs to know some Linux Commands. ss command is a tool that is used for displaying network socket related information on a Linux system. The tool displays more detailed information than the netstat command which is used for displaying active socket connections. In this article, you will learn ss Command Examples to Monitor Network Connections. If you are preparing to purchase your own Linux VPS, the available packages of Eldernode are economical and VIP.

Tutorial ss Command Examples To Monitor Network Connections

Join us with this article to see how the ss command can be used to display varied socket connection information in Linux. In the following of this tutorial, you will learn 12 ss command examples. If you are a new starting user, have a look at our article on 10 useful Linux command Line tricks for Newbies.

Recommended Article: Install SSH Server On Linux And Allow Root User Login

Note: If you need to limit normal users to log in and log back in as the root account, you may set up the superuser or root privileges for our normal account. So a normal user should put the word sudo before the command to run commands with administrative privileges.

How to list all connections (ss Command Examples)

To list all the connections regardless of the state they are in, use the basic ss command without any options.

ss  

How to list listening and Non-listening ports

You can use use the -a option to retrieve a list of both listening and non-listening ports.

ss -a

How to list listening sockets

To display listening sockets only, use the -l flag.

ss -l  

How to list all TCP connections

To display all TCP connections, use the -t option.

ss -t  

How to list all listening TCP connections

Use the -lt combination to have a view of all the listening TCP socket connection.

ss -lt  

List all UDP connections

View all the UDP socket connections by using the -ua option.

ss -ua  

How to list all listening UDP connections

To list listening UDP connections use the -lu option.

ss -lu  

How to display PID (Process IDs) of sockets

To display the Process IDs related to socket connections, use the -p flag.

ss -p  

How to display summary statistics

To list the summary statistics, use the -s option.

ss -s  

How to display IPv4 and IPv6 socket connections

If you are curious about the IPv4 socket connections use the -4 option.

ss -4  

To display IPv6 connections, use the -6 option.

ss -6  

How to filter connections by port number

To filter the socket port number or address number, you can use the ss command too. For example, to display all socket connections with a destination or source port of ssh run the command.

ss -at '( dport = :22 or sport = :22 )'  

Alternatively, you can run the command.

ss -at '( dport = :ssh or sport = :ssh )'

How to check man pages for ss Command

To get more insights into the ss command usage, check the man pages using the command below.

man ss

Conclusion

In this article, you reviewed 12 examples of ss commands. Those are some of the commonly used options that are used with the ss command. The command is considered more superior to the netstat command and provides detailed information about network connections. Find a related article to learn about Linux commands on A to Z Linux commands overview with examples.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

View More Posts
Marilyn Bisson
Content Writer
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

10 thoughts on “ss Command Examples To Monitor Network Connections

    1. Since network monitoring of all hosts in your environment is enabled by default, you need to follow the below path to disable and re-enable it by clicking the Monitoring: Off/On switch:
      Settings > Monitoring overview and on the Hosts tab.

    1. Yes, sure. Follow the below path to monitor network connections in windows.
      Enter 'netstat -a' to view current connections
      Enter 'netstat -b' to see the programs using connections

    1. Sometimes it is possible to be connected to a computer but not be able to access other PCs and devices on our network. The reason often is for incorrect settings on the device on your device or a broken network connection.

    1. In an operating server, listen port is an endpoint. It is not a hardware device, but a logical construct that identifies a service or process.

    1. Yes, you can list all of the clients connected to HTTP or HTTPS. To do this you need to use the ss command or netstat command.

Leave a Reply

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

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day