{"id":8866,"date":"2024-07-02T16:14:45","date_gmt":"2024-07-02T16:14:45","guid":{"rendered":"https:\/\/www.webhi.com\/how-to\/?p=8866"},"modified":"2024-07-02T16:16:51","modified_gmt":"2024-07-02T16:16:51","slug":"how-to-use-the-ss-command-linux-tutorial","status":"publish","type":"post","link":"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/","title":{"rendered":"How to Use the\u00a0ss\u00a0command: A comprehensive Guide"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/ss_linux_en.jpg\" alt=\"Linux ss command usage Debian Ubuntu centos almalinux\" class=\"wp-image-8877\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/ss_linux_en.jpg 1200w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/ss_linux_en-300x169.jpg 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/ss_linux_en-1024x576.jpg 1024w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/ss_linux_en-768x432.jpg 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/ss_linux_en-150x84.jpg 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p>If you&#8217;re like me, you still cling to soon-to-be-deprecated commands like\u00a0<strong><code>ifconfig<\/code>,\u00a0<code>nslookup<\/code>, and\u00a0<code>netstat<\/code><\/strong>. The new replacements are\u00a0<strong><code>ip<\/code>,\u00a0<code>dig<\/code>, and\u00a0<code>ss<\/code><\/strong>, respectively. It&#8217;s time to (reluctantly) let go of legacy utilities and head into the future with\u00a0<code>ss<\/code>. The\u00a0<code>ip<\/code>\u00a0command is worth a mention here because part of\u00a0<code>netstat<\/code>&#8216;s functionality has been replaced by\u00a0<code>ip<\/code>. This article covers the essentials for the\u00a0<code>ss<\/code>\u00a0command so that you don&#8217;t have to dig (no pun intended) for them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"introduction-to-ss\">Introduction to&nbsp;<code>ss<\/code><\/h2>\n\n\n\n<p>Formally,&nbsp;<code>ss<\/code>&nbsp;(socket statistics) is a command-line utility used to investigate sockets. It is the modern replacement for the older&nbsp;<code>netstat<\/code>&nbsp;tool. The primary advantage of&nbsp;<code>ss<\/code>&nbsp;over&nbsp;<code>netstat<\/code>&nbsp;is its ability to provide more detailed and more extensive information about network connections, making it an essential tool for network administrators and engineers.<\/p>\n\n\n\n<p>Michael Prokop, the developer of&nbsp;<code>ss<\/code>, designed it to ease the transition from&nbsp;<code>netstat<\/code>&nbsp;by allowing some of&nbsp;<code>netstat<\/code>&#8216;s options to operate similarly in&nbsp;<code>ss<\/code>. This compatibility helps users to switch without needing to learn an entirely new set of commands from scratch.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"basic-usage\">Basic Usage<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-tcp-sockets\">Displaying TCP Sockets<\/h3>\n\n\n\n<p>One of the most common uses of&nbsp;<code>netstat<\/code>&nbsp;is to display TCP sockets. Here&#8217;s how you can do it with both&nbsp;<code>netstat<\/code>&nbsp;and&nbsp;<code>ss<\/code>:<\/p>\n\n\n\n<p><strong>With&nbsp;<code>netstat<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ netstat -t\nActive Internet connections (w\/o servers)\nProto Recv-Q Send-Q Local Address           Foreign Address         State\ntcp        0      0 rhel8:ssh               khess-mac:62036         ESTABLISHED<\/code><\/pre>\n\n\n\n<p><strong>With&nbsp;<code>ss<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -t\nState         Recv-Q          Send-Q                    Local Address:Port                   Peer Address:Port\nESTAB         0               0                          192.168.1.65:ssh                    192.168.1.94:62036<\/code><\/pre>\n\n\n\n<p>The output from both commands provides similar information, showing active TCP connections.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"resolving-hostnames\">Resolving Hostnames<\/h3>\n\n\n\n<p>To better mimic the output of&nbsp;<code>netstat<\/code>, you can use the&nbsp;<code>-r<\/code>&nbsp;(resolve) option in&nbsp;<code>ss<\/code>, which resolves hostnames:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -tr\nState            Recv-Q             Send-Q                          Local Address:Port                         Peer Address:Port\nESTAB            0                  0                                       rhel8:ssh                             khess-mac:62036<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-port-numbers\">Displaying Port Numbers<\/h3>\n\n\n\n<p>If you prefer seeing port numbers rather than their service names, use the&nbsp;<code>-n<\/code>&nbsp;option:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -ntr\nState            Recv-Q             Send-Q                          Local Address:Port                         Peer Address:Port\nESTAB            0                  0                                       rhel8:22                              khess-mac:62036<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-all-sockets\">Displaying All Sockets<\/h3>\n\n\n\n<p>To display all sockets, including listening and non-listening, use the&nbsp;<code>-a<\/code>&nbsp;option:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -a\nState       Recv-Q      Send-Q               Local Address:Port                Peer Address:Port\nLISTEN      0           128                  0.0.0.0:22                        0.0.0.0:*\nESTAB       0           0                    192.168.1.65:ssh                  192.168.1.94:62036<\/code><\/pre>\n\n\n\n<p>This command lists all sockets in various states.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"filtering-by-state\">Filtering by State<\/h3>\n\n\n\n<p>You can filter the output to show only sockets in a specific state. For example, to show only listening sockets:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -l\nState       Recv-Q      Send-Q               Local Address:Port                Peer Address:Port\nLISTEN      0           128                  0.0.0.0:22                        0.0.0.0:*\nLISTEN      0           128                  [::]:22                           [::]:*<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-unix-domain-sockets\">Displaying Unix Domain Sockets<\/h3>\n\n\n\n<p>To display Unix domain sockets, use the&nbsp;<code>-x<\/code>&nbsp;option:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -x\nState       Recv-Q      Send-Q               Local Address:Port                Peer Address:Port\nLISTEN      0           128                  \/run\/user\/0\/systemd\/private       * 0\nLISTEN      0           128                  \/var\/lib\/sss\/pipes\/private\/sbus-dp_implicit_files.642  * 0<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-summary-statistics\">Displaying Summary Statistics<\/h3>\n\n\n\n<p>To view summary statistics of all socket connections, use the&nbsp;<code>-s<\/code>&nbsp;option:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -s\nTotal: 182\nTCP:   3 (estab 1, closed 0, orphaned 0, timewait 0)\n\nTransport Total     IP        IPv6\nRAW      1         0         1\nUDP      3         2         1\nTCP      3         2         1\nINET     7         4         3\nFRAG     0         0         0<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"advanced-usage\">Advanced Usage<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"filtering-by-address-and-port\">Filtering by Address and Port<\/h3>\n\n\n\n<p>You can filter sockets based on local or remote addresses and ports. For example, to show all sockets connected to port 22:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -at '( dport = :22 )'\nState       Recv-Q      Send-Q               Local Address:Port                Peer Address:Port\nLISTEN      0           128                  0.0.0.0:22                        0.0.0.0:*\nESTAB       0           0                    192.168.1.65:ssh                  192.168.1.94:62036<\/code><\/pre>\n\n\n\n<p>To filter by local address:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -at '( src = 192.168.1.65 )'\nState       Recv-Q      Send-Q               Local Address:Port                Peer Address:Port\nESTAB       0           0                    192.168.1.65:ssh                  192.168.1.94:62036<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"combining-filters\">Combining Filters<\/h3>\n\n\n\n<p>You can combine multiple filters to refine your search. For example, to show all TCP connections to port 22 on a specific IP address:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -at '( dport = :22 and src = 192.168.1.65 )'\nState       Recv-Q      Send-Q               Local Address:Port                Peer Address:Port\nESTAB       0           0                    192.168.1.65:ssh                  192.168.1.94:62036<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-connection-states\">Displaying Connection States<\/h3>\n\n\n\n<p>To display sockets in specific states such as&nbsp;<code>ESTABLISHED<\/code>,&nbsp;<code>LISTEN<\/code>, or&nbsp;<code>CLOSE-WAIT<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss state established\nState       Recv-Q      Send-Q               Local Address:Port                Peer Address:Port\nESTAB       0           0                    192.168.1.65:ssh                  192.168.1.94:62036<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-network-interfaces\">Displaying Network Interfaces<\/h3>\n\n\n\n<p>To display information about network interfaces, use the&nbsp;<code>-i<\/code>&nbsp;option:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -i\nNetid     State       Recv-Q      Send-Q           Local Address:Port             Peer Address:Port\nu_str     ESTAB       0           0                            * 20241                           * 0\n         skmem:(r0,rb79377,t0,tb32768,f1348,w0,o0,bl0,d0)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"comparison-with-netstat\">Comparison with&nbsp;<code>netstat<\/code><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-group-memberships\">Displaying Group Memberships<\/h3>\n\n\n\n<p>Some functionality of&nbsp;<code>netstat<\/code>&nbsp;has been moved to the&nbsp;<code>ip<\/code>&nbsp;command. For example, to display group memberships:<\/p>\n\n\n\n<p><strong>With&nbsp;<code>netstat<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ netstat -g\nIPv6\/IPv4 Group Memberships\nInterface       RefCnt Group\n--------------- ------ ---------------------\nlo              1      all-systems.mcast.net\nenp0s3          1      all-systems.mcast.net\nlo              1      ff02::1\nlo              1      ff01::1\nenp0s3          1      ff02::1:ffa6:ab3e\nenp0s3          1      ff02::1:ff8d:912c\nenp0s3          1      ff02::1\nenp0s3          1      ff01::1<\/code><\/pre>\n\n\n\n<p><strong>With&nbsp;<code>ip<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ip maddr\n1: lo\n    inet  224.0.0.1\n    inet6 ff02::1\n    inet6 ff01::1\n2: enp0s3\n    link  01:00:5e:00:00:01\n    link  33:33:00:00:00:01\n    link  33:33:ff:8d:91:2c\n    link  33:33:ff:a6:ab:3e\n    inet  224.0.0.1\n    inet6 ff02::1:ffa6:ab3e\n    inet6 ff02::1:ff8d:912c\n    inet6 ff02::1\n    inet6 ff01::1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-network-statistics\">Displaying Network Statistics<\/h3>\n\n\n\n<p><code>netstat<\/code>&nbsp;provides detailed network statistics, which&nbsp;<code>ss<\/code>&nbsp;currently lacks:<\/p>\n\n\n\n<p><strong>With&nbsp;<code>netstat<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ netstat -s\nIp:\n    Forwarding: 2\n    6231 total packets received\n    2 with invalid addresses\n    0 forwarded\n    0 incoming packets discarded\n    3104 incoming packets delivered\n    2011 requests sent out\n    243 dropped because of missing route\n&lt;truncated&gt;<\/code><\/pre>\n\n\n\n<p><strong>With&nbsp;<code>ss<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -s\nTotal: 182\nTCP:   3 (estab 1, closed 0, orphaned 0, timewait 0)\n\nTransport Total     IP        IPv6\nRAW\t  1         0         1\nUDP\t  3         2         1\nTCP\t  3         2         1\nINET\t  7         4         3\nFRAG\t  0         0         0<\/code><\/pre>\n\n\n\n<p>As you can see,&nbsp;<code>ss<\/code>&nbsp;provides a more concise summary of statistics compared to the detailed breakdown offered by&nbsp;<code>netstat<\/code>. For those who need granular statistics, this can be a limitation of&nbsp;<code>ss<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"practical-examples\">Practical Examples<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"monitoring-network-connections\">Monitoring Network Connections<\/h3>\n\n\n\n<p>One practical use of&nbsp;<code>ss<\/code>&nbsp;is to monitor active network connections in real-time. This can be especially useful for troubleshooting network issues or ensuring that services are running as expected.<\/p>\n\n\n\n<p>To watch active connections, you can use&nbsp;<code>watch<\/code>&nbsp;with&nbsp;<code>ss<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ watch -n 1 'ss -t -a'<\/code><\/pre>\n\n\n\n<p>This command updates the display every second, showing you the current state of TCP connections.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"checking-listening-ports\">Checking Listening Ports<\/h3>\n\n\n\n<p>To see which ports are being listened to by various services on your system, use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -ltn\nState      Recv-Q Send-Q  Local Address:Port   Peer Address:Port\nLISTEN     0      128     0.0.0.0:22           0.0.0.0:*\nLISTEN     0      128     [::]:22              [::]:*<\/code><\/pre>\n\n\n\n<p>This command helps identify all listening TCP ports and the services bound to them, useful for ensuring that required services are up and running.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"diagnosing-network-problems\">Diagnosing Network Problems<\/h3>\n\n\n\n<p>When diagnosing network problems,&nbsp;<code>ss<\/code>&nbsp;can be used to filter connections by various parameters to pinpoint issues.<\/p>\n\n\n\n<p>For example, if you suspect an issue with connections to a specific server, you can filter by the remote address:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -t dst 192.168.1.94\nState      Recv-Q Send-Q  Local Address:Port   Peer Address:Port\nESTAB      0      0       192.168.1.65:ssh     192.168.1.94:62036<\/code><\/pre>\n\n\n\n<p>This command shows all TCP connections to the specified remote address.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"analyzing-traffic-on-specific-ports\">Analyzing Traffic on Specific Ports<\/h3>\n\n\n\n<p>To analyze traffic on a specific port, such as port 80 (HTTP), you can use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -o state established '( dport = :80 or sport = :80 )'\nState      Recv-Q Send-Q  Local Address:Port   Peer Address:Port  Timer\nESTAB      0      0       192.168.1.65:49852   93.184.216.34:80   on (5.34\/8.74)<\/code><\/pre>\n\n\n\n<p>This command shows established connections involving port 80, providing insight into web traffic.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"transitioning-from-netstat-to-ss\">Transitioning from&nbsp;<code>netstat<\/code>&nbsp;to&nbsp;<code>ss<\/code><\/h2>\n\n\n\n<p>Transitioning from&nbsp;<code>netstat<\/code>&nbsp;to&nbsp;<code>ss<\/code>&nbsp;can be seamless if you understand the equivalent options and commands. Here are some common&nbsp;<code>netstat<\/code>&nbsp;commands and their&nbsp;<code>ss<\/code>&nbsp;equivalents:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-network-interface-statistics\">Displaying Network Interface Statistics<\/h3>\n\n\n\n<p><strong>With&nbsp;<code>netstat<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ netstat -i\nKernel Interface table\nIface      MTU    RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\neth0       1500   983   0      0      0      879   0      0      0      BMRU\nlo         65536  8821  0      0      0      8821  0      0      0      LRU<\/code><\/pre>\n\n\n\n<p><strong>With&nbsp;<code>ss<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -i\nNetid     State       Recv-Q      Send-Q           Local Address:Port             Peer Address:Port\nu_str     ESTAB       0           0                            * 20241                           * 0\n         skmem:(r0,rb79377,t0,tb32768,f1348,w0,o0,bl0,d0)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-routing-table\">Displaying Routing Table<\/h3>\n\n\n\n<p><strong>With&nbsp;<code>netstat<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ netstat -r\nKernel IP routing table\nDestination     Gateway         Genmask         Flags   MSS Window  irtt Iface\n0.0.0.0         192.168.1.1     0.0.0.0         UG      0   0        0   eth0\n192.168.1.0     0.0.0.0         255.255.255.0   U       0   0        0   eth0<\/code><\/pre>\n\n\n\n<p><strong>With&nbsp;<code>ip<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ip route\ndefault via 192.168.1.1 dev eth0\n192.168.1.0\/24 dev eth0 proto kernel scope link src 192.168.1.65<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-multicast-group-memberships\">Displaying Multicast Group Memberships<\/h3>\n\n\n\n<p><strong>With&nbsp;<code>netstat<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ netstat -g\nIPv6\/IPv4 Group Memberships\nInterface       RefCnt Group\n--------------- ------ ---------------------\nlo              1      all-systems.mcast.net\nenp0s3          1      all-systems.mcast.net\nlo              1      ff02::1\nlo              1      ff01::1\nenp0s3          1      ff02::1:ffa6:ab3e\nenp0s3          1      ff02::1:ff8d:912c\nenp0s3          1      ff02::1\nenp0s3          1      ff01::1\n<\/code><\/pre>\n\n\n\n<p><strong>With&nbsp;<code>ip<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ip maddr\n1: lo\n    inet  224.0.0.1\n    inet6 ff02::1\n    inet6 ff01::1\n2: enp0s3\n    link  01:00:5e:00:00:01\n    link  33:33:00:00:00:01\n    link  33:33:ff:8d:91:2c\n    link  33:33:ff:a6:ab:3e\n    inet  224.0.0.1\n    inet6 ff02::1:ffa6:ab3e\n    inet6 ff02::1:ff8d:912c\n    inet6 ff02::1\n    inet6 ff01::1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"displaying-network-protocol-statistics\">Displaying Network Protocol Statistics<\/h3>\n\n\n\n<p><strong>With&nbsp;<code>netstat<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ netstat -s\nIp:\n    Forwarding: 2\n    6231 total packets received\n    2 with invalid addresses\n    0 forwarded\n    0 incoming packets discarded\n    3104 incoming packets delivered\n    2011 requests sent out\n    243 dropped because of missing route\n&lt;truncated&gt;<\/code><\/pre>\n\n\n\n<p><strong>With&nbsp;<code>ss<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ss -s\nTotal: 182\nTCP:   3 (estab 1, closed 0, orphaned 0, timewait 0)\n\nTransport Total     IP        IPv6\nRAW\t  1         0         1\nUDP\t  3         2         1\nTCP\t  3         2         1\nINET\t  7         4         3\nFRAG\t  0         0         0<\/code><\/pre>\n\n\n\n<p>As you can see,&nbsp;<code>ss<\/code>&nbsp;provides a summary rather than a detailed breakdown. While this can be useful for quick overviews, it might not provide the depth of information needed for thorough network diagnostics.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>The&nbsp;<code>ss<\/code>&nbsp;command is a powerful and versatile tool that has effectively replaced&nbsp;<code>netstat<\/code>&nbsp;for investigating socket statistics. While it offers many of the same functionalities as&nbsp;<code>netstat<\/code>, it also introduces new features and more detailed output options. Transitioning to&nbsp;<code>ss<\/code>&nbsp;from&nbsp;<code>netstat<\/code>&nbsp;is made easier by the similar options and commands, allowing users to continue their network monitoring and troubleshooting activities with minimal adjustment.<\/p>\n\n\n\n<p>By learning and mastering&nbsp;<code>ss<\/code>, you can take advantage of its capabilities to manage and diagnose network connections more efficiently. Whether you are monitoring active connections, checking listening ports, diagnosing network problems, or analyzing traffic,&nbsp;<code>ss<\/code>&nbsp;provides a robust set of options to help you get the job done.<\/p>\n\n\n\n<p>So, embrace the future of network statistics with&nbsp;<code>ss<\/code>&nbsp;and leverage its powerful features to enhance your network administration tasks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re like me, you still cling to soon-to-be-deprecated commands like\u00a0ifconfig,\u00a0nslookup, and\u00a0netstat. The new replacements are\u00a0ip,\u00a0dig, and\u00a0ss, respectively. It&#8217;s time to (reluctantly) let go of legacy utilities and head into the future with\u00a0ss. The\u00a0ip\u00a0command is worth a mention here because part of\u00a0netstat&#8216;s functionality has been replaced by\u00a0ip. This article covers the essentials for the\u00a0ss\u00a0command so ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[69,3],"tags":[],"yoast_head":"\n<title>How to Use the\u00a0ss\u00a0command: A comprehensive Guide - WebHi Tutorials &amp; Documentations<\/title>\n<meta name=\"description\" content=\"Learn how to use the ss command in Linux to replace the soon-to-be-obsolete netstat. This article covers essential ss commands, practical examples for monitoring network connections, verifying listening ports, diagnosing network issues, and analyzing traffic on specific ports.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use the\u00a0ss\u00a0command: A comprehensive Guide - WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"og:description\" content=\"Learn how to use the ss command in Linux to replace the soon-to-be-obsolete netstat. This article covers essential ss commands, practical examples for monitoring network connections, verifying listening ports, diagnosing network issues, and analyzing traffic on specific ports.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webhi.technology\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-02T16:14:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-02T16:16:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/ss_linux_en.jpg\" \/>\n<meta name=\"author\" content=\"webhi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:site\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webhi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/\"},\"author\":{\"name\":\"webhi\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\"},\"headline\":\"How to Use the\u00a0ss\u00a0command: A comprehensive Guide\",\"datePublished\":\"2024-07-02T16:14:45+00:00\",\"dateModified\":\"2024-07-02T16:16:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/\"},\"wordCount\":945,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"articleSection\":[\"Linux system administration\",\"Security\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/\",\"name\":\"How to Use the\u00a0ss\u00a0command: A comprehensive Guide - WebHi Tutorials &amp; Documentations\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\"},\"datePublished\":\"2024-07-02T16:14:45+00:00\",\"dateModified\":\"2024-07-02T16:16:51+00:00\",\"description\":\"Learn how to use the ss command in Linux to replace the soon-to-be-obsolete netstat. This article covers essential ss commands, practical examples for monitoring network connections, verifying listening ports, diagnosing network issues, and analyzing traffic on specific ports.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webhi.com\/how-to\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Use the\u00a0ss\u00a0command: A comprehensive Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"name\":\"WebHi Tutorials &amp; Documentations\",\"description\":\"System administration and knowledge base\",\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\",\"name\":\"WebHi Technology\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"width\":288,\"height\":95,\"caption\":\"WebHi Technology\"},\"image\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webhi.technology\",\"https:\/\/twitter.com\/WebHiTechnology\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\",\"name\":\"webhi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1784239260\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1784239260\",\"caption\":\"webhi\"},\"sameAs\":[\"https:\/\/www.webhi.com\/how-to\"],\"url\":\"https:\/\/www.webhi.com\/how-to\/author\/webhi\/\"}]}<\/script>\n","yoast_head_json":{"title":"How to Use the\u00a0ss\u00a0command: A comprehensive Guide - WebHi Tutorials &amp; Documentations","description":"Learn how to use the ss command in Linux to replace the soon-to-be-obsolete netstat. This article covers essential ss commands, practical examples for monitoring network connections, verifying listening ports, diagnosing network issues, and analyzing traffic on specific ports.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"How to Use the\u00a0ss\u00a0command: A comprehensive Guide - WebHi Tutorials &amp; Documentations","og_description":"Learn how to use the ss command in Linux to replace the soon-to-be-obsolete netstat. This article covers essential ss commands, practical examples for monitoring network connections, verifying listening ports, diagnosing network issues, and analyzing traffic on specific ports.","og_url":"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/","og_site_name":"WebHi Tutorials &amp; Documentations","article_publisher":"https:\/\/www.facebook.com\/webhi.technology","article_published_time":"2024-07-02T16:14:45+00:00","article_modified_time":"2024-07-02T16:16:51+00:00","og_image":[{"url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/ss_linux_en.jpg"}],"author":"webhi","twitter_card":"summary_large_image","twitter_creator":"@WebHiTechnology","twitter_site":"@WebHiTechnology","twitter_misc":{"Written by":"webhi","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/#article","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/"},"author":{"name":"webhi","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54"},"headline":"How to Use the\u00a0ss\u00a0command: A comprehensive Guide","datePublished":"2024-07-02T16:14:45+00:00","dateModified":"2024-07-02T16:16:51+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/"},"wordCount":945,"commentCount":0,"publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"articleSection":["Linux system administration","Security"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/","url":"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/","name":"How to Use the\u00a0ss\u00a0command: A comprehensive Guide - WebHi Tutorials &amp; Documentations","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/#website"},"datePublished":"2024-07-02T16:14:45+00:00","dateModified":"2024-07-02T16:16:51+00:00","description":"Learn how to use the ss command in Linux to replace the soon-to-be-obsolete netstat. This article covers essential ss commands, practical examples for monitoring network connections, verifying listening ports, diagnosing network issues, and analyzing traffic on specific ports.","breadcrumb":{"@id":"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhi.com\/how-to\/how-to-use-the-ss-command-linux-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhi.com\/how-to\/"},{"@type":"ListItem","position":2,"name":"How to Use the\u00a0ss\u00a0command: A comprehensive Guide"}]},{"@type":"WebSite","@id":"https:\/\/www.webhi.com\/how-to\/#website","url":"https:\/\/www.webhi.com\/how-to\/","name":"WebHi Tutorials &amp; Documentations","description":"System administration and knowledge base","publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhi.com\/how-to\/#organization","name":"WebHi Technology","url":"https:\/\/www.webhi.com\/how-to\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","contentUrl":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","width":288,"height":95,"caption":"WebHi Technology"},"image":{"@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webhi.technology","https:\/\/twitter.com\/WebHiTechnology"]},{"@type":"Person","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54","name":"webhi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/","url":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1784239260","contentUrl":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1784239260","caption":"webhi"},"sameAs":["https:\/\/www.webhi.com\/how-to"],"url":"https:\/\/www.webhi.com\/how-to\/author\/webhi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/8866"}],"collection":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/comments?post=8866"}],"version-history":[{"count":5,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/8866\/revisions"}],"predecessor-version":[{"id":8886,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/8866\/revisions\/8886"}],"wp:attachment":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/media?parent=8866"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/categories?post=8866"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/tags?post=8866"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}