The ss command on Linux is extremely useful for investigating sockets, providing various information about the network. It is the evolution of the netstat command from the old Net-Tools. It is important to understand that a socket can be a network connection, as well as a Unix-like socket, which is a special file that acts as a “communication bridge” between two programs.
Your most common options are:
-s: shows network statistics;
Some options may be combined to form a given result.
Examples:
To view network statistics:
$ ss -s
Total: 1020
TCP: 25 (estab 2, closed 1, orphaned 0, timewait 1)
Transport Total IP IPv6
RAW 1 0 1
UDP 9 6 3
TCP 24 22 2
INET 34 28 6
FRAG 0 0 0
To view open TCP ports (under LISTENING):
$ ss -lt
State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 127.0.0.53% lo:domain 0.0.0.0: * LISTEN 0 128 0.0.0.0:ssh 0.0.0.0: * LISTEN 0 128 [::] :ssh [::] :*
To show the open TCP and UDP ports and the processes that own the sockets. To show the processes, the user must be the root administrator, or using sudo command to gain superpowers:
# ss -ltpu Netid State Local Address udo UNCONN 127.0.0. 1:323 users :( (“chronyd”, pid=20898, fd=5)) tcp LISTEN 0.0.0.0:ssh users: ((“sshd”, pid=9857, fd=3))
Shows all connections established on port (22) of ssh:
$ ss -o state established '(dport =:ssh or sport =:ssh)'
Netid Recv-Q Send-Q Local Address:Port Peer Address:Port
TCP 0 0 10.211.55.63:ssh& nbsp; 10,211.55. 2:64749 timer :( keepalive,104 min,0)
This command is useful for diagnosing the following problems:
The sudo command on Linux executes a given command as if it were another user.…
Free Linux command shows the amount of total memory in use and available, as well…
The shell has structures for testing conditions and executing certain program sequences several times (loop),…
The /etc/fstab file stores the configuration of which devices should be mounted and what is…
The Netcat Command in Linux or nc is a utility used to do “almost anything”…
The gdisk command in Linux is similar to fdisk and allows you to manipulate and…
This website uses cookies.