ss – command

The ss command is used to show socket statistics. It can display stats for PACKET sockets, TCP sockets, UDP sockets, DCCP sockets, RAW sockets, Unix domain sockets, and more.
It allows showing information similar to the netstat command. SS can provide information about:

-All TCP sockets.
-All UDP sockets.
-All established ssh/http/https connections.
-All local processes connected to the server.
-Filtering by state (such as connected, synchronized, SYN-RECV, SYN-SENT,TIME-WAIT), addresses and ports.
-All the TCP sockets in state FIN-WAIT1 and more.

List currently established, closed, orphaned and waiting TCP sockets:

~# ss -s

Display all open network ports:

~# ss -l

See the process named using open socket:

~# ss -pl

Find out who is responsible for opening socket / port #21:

~# ss -lp | grep 21

“init” (PID #1579) is responsible for opening port #21. You can get more on the process by going to:

~# cd /proc/1579
~# ls -l

Display all TCP sockets:

~# ss -t -a

Display all UDP sockets:

~# ss -u -a

Display all RAW sockets:

~# ss -w -a

Display all UNIX sockets:

~# ss -x -a

Display all established SMTP connections:

~# ss -o state established ‘( dport = :smtp or sport = :smtp )’

Display all established HTTP connections:

~# ss -o state established ‘( dport = :http or sport = :http )’

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s