ss Linux Command
Modern replacement for netstat. Dumps socket statistics quickly.
What does ss do?
Modern replacement for netstat. Dumps socket statistics quickly.
Syntax
ss [options]Practical example
ss -tulpnQuestions about ss
How do I see all listening ports?
Use `ss -tlnp` to show all listening TCP ports with process names. The `-t` is TCP, `-l` is listening, `-n` is numeric, `-p` shows processes.
What does ss -tulpn show?
Shows all TCP and UDP listening sockets with numeric addresses and the process using each socket. This is the most common ss command.
How do I see all established connections?
Use `ss -tnp state established` to show only established TCP connections. This filters out listening and other states.
How do I see UDP connections with ss?
Use `ss -ulnp` to show all listening UDP sockets. The `-u` flag filters for UDP instead of TCP.
How do I see socket statistics summary?
Run `ss -s` to get a summary of socket statistics including total sockets, TCP, UDP, and other protocol counts.
How do I filter connections by port?
Use `ss -tn sport = :22` to filter by source port 22, or `ss -tn dport = :443` to filter by destination port 443.
How do I see connections to a specific IP?
Use `ss -tn dst 192.168.1.100` to filter connections to a specific destination IP address.
How do I see memory usage of sockets?
Use `ss -m` to display memory usage information for each socket, including send and receive buffer sizes.
Related Networking Commands
netstatDisplays network connections, routing tables, interface statistics, and more.
curlTransfers data from or to a server using various protocols (HTTP, FTP, etc.).
ipModern replacement for ifconfig. Shows and manipulates routing, devices, and tunnels.
wgetDownloads files from the internet non-interactively via HTTP, HTTPS, or FTP.
ifconfigDisplays or configures network interface parameters (deprecated, use ip).
digPerforms DNS lookups and displays detailed name server query information.