SS(8)
๐ ss(8) โ another utility to investigate sockets ๐
okay bestie, sit down, grab a strawberry ๐, because we're about to get so cozy with ss(8) โ the System Manager's Manual's own certified socket-investigator icon. yes she lives in section 8 (that's the sysadmin section, iykyk ๐). she's a utility to investigate sockets and she ate, no cap.
โจ NAME โจ
ss โ another utility to investigate sockets ๐ฆ
โจ SYNOPSIS โจ
ss [options] [ FILTER ]
โจ DESCRIPTION โจ
ss is used to dump socket statistics. it lets you show information that's similar to netstat, which, love her, but. and get this โ she can display more TCP and state information than other tools do. it's giving main character energy fr fr ๐
โจ OPTIONS โจ
okay so when you use no option at all, ss shows you a list of open non-listening sockets (that's your TCP/UNIX/UDP girlies and friends ๐) that have established connections. so if you just run her bare, that's the vibe you get.
-h,--helpโ show a summary of the options. a lil cheat sheet, we love her ๐-V,--versionโ output version information. who is she? what era is she from? find out โญ-H,--no-headerโ suppress the header line. bye bye header ๐-Q,--no-queuesโ suppress the sending and receiving queue columns. the queues are on mute ๐ต-O,--onelineโ print each socket's data on a single line. one socket, one line, minimal chaos ๐ธ-n,--numericโ don't try to resolve service names. and show exact bandwidth values instead of human-readable ones. no pretty rounding, just the raw digits ๐ง-r,--resolveโ try to resolve numeric address/ports. the opposite energy of-n, she wants names ๐ซถ-a,--allโ display both listening and non-listening sockets. (for TCP, "non-listening" means established connections.) everybody's invited to this party ๐ฅ-l,--listeningโ display only listening sockets. and yes, these are omitted by default, so you need this flag if listening is what you're after ๐-B,--bound-inactiveโ display only TCP sockets that are bound but inactive (not listening, not connecting, etc.). these are also omitted by default. the wallflowers get their moment ๐-o,--optionsโ show timer information. for the TCP protocol, the output format is:
timer:(<timer_name>,<expire_time>,<retrans>)
<timer_name>โ the name of the timer. there are five kinds of timer names:onโ means one of these timers: TCP retrans timer, TCP early retrans timer and tail loss probe timerkeepaliveโ tcp keep alive timertimewaitโ timewait stage timerpersistโ zero window probe timerunknownโ none of the above timers ๐
<expire_time>โ how long until the timer will expire โณ<retrans>โ how many times retransmissions have occurred ๐
-e,--extendedโ show detailed socket information. the output format is:
uid:<uid_number> ino:<inode_number> sk:<cookie>
<uid_number>โ the user id the socket belongs to<inode_number>โ the socket's inode number in VFS<cookie>โ a uuid of the socket ๐ช
-m,--memoryโ show socket memory usage. the output format is:
skmem:(r<rmem_alloc>,rb<rcv_buf>,t<wmem_alloc>,tb<snd_buf>,
f<fwd_alloc>,w<wmem_queued>,o<opt_mem>,
bl<back_log>,d<sock_drop>)
<rmem_alloc>โ the memory allocated for receiving packets ๐ฅ<rcv_buf>โ the total memory that can be allocated for receiving packets<wmem_alloc>โ the memory used for sending packets (which has been sent to layer 3) ๐ค<snd_buf>โ the total memory that can be allocated for sending packets<fwd_alloc>โ the memory allocated by the socket as cache, but not used for receiving/sending packets yet. if memory is needed to send/receive packets, the memory in this cache gets used before allocating additional memory. she recycles, she's sustainable ๐<wmem_queued>โ the memory allocated for sending packets (which has not been sent to layer 3)<opt_mem>โ the memory used for storing socket options, e.g., the key for TCP MD5 signature ๐<back_log>โ the memory used for the sk backlog queue. on a process context, if the process is receiving packets, and a new packet is received, it will be put into the sk backlog queue, so it can be received by the process immediately โก<sock_drop>โ the number of packets dropped before they are de-multiplexed into the socket ๐
-p,--processesโ show processes using sockets. who's home ๐-T,--threadsโ show threads using sockets. and heads up, this implies-p๐งต-i,--infoโ show internal TCP information. the below fields may appear:tsโ show string"ts"if the timestamp option is setsackโ show string"sack"if the sack option is setecnโ show string"ecn"if the explicit congestion notification option is setecnseenโ show string"ecnseen"if the saw ecn flag is found in received packetsfastopenโ show string"fastopen"if the fastopen option is setcong_algโ the congestion algorithm name. the default congestion algorithm is"cubic"๐งwscale:<snd_wscale>:<rcv_wscale>โ if window scale option is used, this field shows the send scale factor and receive scale factorrto:<icsk_rto>โ tcp re-transmission timeout value. the unit is millisecond โฑ๏ธbackoff:<icsk_backoff>โ used for exponential backoff re-transmission. the actual re-transmission timeout value isicsk_rto << icsk_backoffrtt:<rtt>/<rttvar>โrttis the average round trip time,rttvaris the mean deviation of rtt. their units are millisecondato:<ato>โ ack timeout. unit is millisecond, used for delay ack modemss:<mss>โ max segment sizecwnd:<cwnd>โ congestion window sizepmtu:<pmtu>โ path MTU valuessthresh:<ssthresh>โ tcp congestion window slow start thresholdbytes_acked:<bytes_acked>โ bytes acked โbytes_received:<bytes_received>โ bytes receivedsegs_out:<segs_out>โ segments sent outsegs_in:<segs_in>โ segments receivedsend <send_bps>bpsโ egress bpslastsnd:<lastsnd>โ how long it has been since the last packet sent. the unit is millisecondlastrcv:<lastrcv>โ how long it has been since the last packet received. the unit is millisecondlastack:<lastack>โ how long it has been since the last ack received. the unit is millisecondpacing_rate <pacing_rate>bps/<max_pacing_rate>bpsโ the pacing rate and max pacing ratercv_space:<rcv_space>โ a helper variable for TCP internal auto tuning socket receive buffer- MPTCP subflow information:
tcp-ulp-mptcp flags:[MmBbJjecv]
token:<rem_token(rem_id)/loc_token(loc_id)> seq:<sn> sfseq:<ssn>
ssnoff:<off> maplen:<maplen>
--tosโ show ToS and priority information. the below fields may appear:tosโ IPv4 Type-of-Service bytetclassโ IPv6 Traffic Class byteclass_idโ Class id set bynet_clscgroup. if class is zero, this shows priority set bySO_PRIORITY.
--cgroupโ show cgroup information. the below fields may appear:cgroupโ Cgroup v2 pathname. this pathname is relative to the mount point of the hierarchy ๐๏ธ
--tipcinfoโ show internal tipc socket information.-K,--killโ attempts to forcibly close sockets. this option displays sockets that are successfully closed, and silently skips sockets that the kernel does not support closing. she supports IPv4 and IPv6 sockets only.
โ ๏ธ hello bestie, this one closes sockets. forcibly. like, that's the whole point. read the room before you type it ๐
-s,--summaryโ print summary statistics. this option does not parse socket lists โ it obtains the summary from various sources instead. it's useful when the amount of sockets is so huge that parsing/proc/net/tcpis painful ๐ญ (and honestly, at that scale? it is painful.)-E,--eventsโ continually display sockets as they are destroyed ๐โจ-Z,--contextโ as the-poption, but also shows process security context. if the-Toption is used, it also shows thread security context. fornetlink(7)sockets, the initiating process context is displayed as follows:- If valid pid, show the process context.
- If destination is kernel (
pid = 0), show kernel initial context. - If a unique identifier has been allocated by the kernel or netlink user, show context as
"unavailable". this will generally indicate that a process has more than one netlink socket active.
-z,--contextsโ as the-Zoption, but also shows the socket context. the socket context is taken from the associated inode and is not the actual socket context held by the kernel. sockets are typically labeled with the context of the creating process, however the context shown will reflect any policy role, type and/or range transition rules applied, and is therefore a useful reference. ๐ท๏ธ-N NSNAME,--net=NSNAMEโ switch to the specified network namespace name. hopping dimensions ๐-b,--bpfโ show socket classic BPF filters. (only administrators are allowed to get this information, so don't get mad at her if she won't tell you ๐)-4,--ipv4โ display only IP version 4 sockets (alias for-f inet).-6,--ipv6โ display only IP version 6 sockets (alias for-f inet6).-0,--packetโ display PACKET sockets (alias for-f link).-t,--tcpโ display TCP sockets.-u,--udpโ display UDP sockets.-w,--rawโ display RAW sockets.-x,--unixโ display Unix domain sockets (alias for-f unix).-S,--sctpโ display SCTP sockets.--tipcโ display tipc sockets (alias for-f tipc).--vsockโ display vsock sockets (alias for-f vsock).--xdpโ display XDP sockets (alias for-f xdp).-M,--mptcpโ display MPTCP sockets.--inet-sockoptโ display inet socket options.-f FAMILY,--family=FAMILYโ display sockets of type FAMILY. currently the following families are supported:unix,inet,inet6,link,netlink,vsock,tipc,xdp. ๐ฆ-A QUERY,--query=QUERY,--socket=QUERYโ bestie, this is your socket-table menu ๐ Give it a comma-separated list of socket tables to dump. The identifiers that hit:all,inet,tcp,udp,raw,unix,packet,netlink,unix_dgram,unix_stream,unix_seqpacket,packet_raw,packet_dgram,sctp,tipc,vsock_stream,vsock_dgram,xdp,mptcp. And plot twist: you can slap a!in front of any item to exclude that socket table from the dump. So'all,!tcp'vibes are fully valid. ๐-D FILE,--diag=FILEโ shows you nothing on screen, iconic behavior honestly โ it just dumps raw info about TCP sockets into FILE after applying your filters. And if FILE is-, stdout gets it instead. โจ-F FILE,--filter=FILEโ read your filter info from FILE. Every single line of FILE gets interpreted like one command line option. If FILE is-, it reads from stdin. ๐--bpf-mapsโ pretty-prints all the BPF socket-local data entries for each socket. So pretty. So much data. ๐ฆ--bpf-map-id=MAP_IDโ pretty-prints the BPF socket-local data entries for the map ID you asked for. And yes, you can use it more than once, stack 'em up. ๐ธFILTER := [ state STATE-FILTER ] [ EXPRESSION ]โ this is the shape of a filter. For the full deets on filters, go look at the official documentation, bestie, I'm just the messenger. ๐
FILTER := [ state STATE-FILTER ] [ EXPRESSION ]
๐ซถ STATE-FILTER ๐ซถ
STATE-FILTER lets you build an arbitrary lil' set of states to match against. Its syntax is a sequence of the keywords state and exclude, each followed by an identifier of a state. Mix and match, make it yours. ๐
The available identifiers are:
- All standard TCP states:
established,syn-sent,syn-recv,fin-wait-1,fin-wait-2,time-wait,closed,close-wait,last-ack,listeningandclosing. allโ for all the states. yes, every single one. ๐connectedโ all the states except forlisteningandclosedsynchronizedโ all the connected states except forsyn-sentbucketโ states which are maintained as minisockets, i.e.time-waitandsyn-recvbigโ the opposite ofbucketbound-inactiveโ bound but otherwise inactive sockets (not listening, not connecting, etc.)
๐ฅ EXPRESSION ๐ฅ
EXPRESSION lets you filter based on specific criteria โ like a vibe check but for sockets. โจ An EXPRESSION is a series of predicates combined by boolean operators. The possible operators, in increasing order of precedence, are or (or | or ||), and (or & or &&), and not (or !). If there's no operator between two consecutive predicates, an implicit and is assumed โ sneaky but true. And you can group subexpressions with "(" and ")". ๐
The following predicates are supported:
{dst|src} [=] HOSTโ tests if the destination or source matches HOST. See HOST SYNTAX for details, bestie, it's right below. ๐{dport|sport} [OP] [FAMILY:]:PORTโ compares the destination or source port to PORT. OP can be any of"<","<=","=","!=",">="and">", following normal arithmetic rules. FAMILY and PORT are as described in HOST SYNTAX below.dev [=|!=] DEVICEโ matches based on the device the connection uses. DEVICE can either be a device name or the index of the interface. ๐ฆfwmark [=|!=] MASKโ matches based on thefwmarkvalue for the connection. This can either be a specific mark value, or a mark value followed by a"/"and a bitmask of which bits to use in the comparison. For example,"fwmark = 0x01/0x03"would match if the two least significant bits of the fwmark were0x01. Math ate, honestly. ๐cgroup [=|!=] PATHโ matches if the connection is part of a cgroup at the given path.autoboundโ matches if the port or path of the source address was automatically allocated (rather than explicitly specified). no thoughts, just vibes. ๐ธ
Most operators have aliases ๐ฏ and if you don't supply an operator, "=" is assumed. Each of the following groups of operators are all equivalent:
=,==,eq!=,ne,neq>,gt<,lt>=,ge,geq<=,le,leq!,not|,||,or&,&&,and
๐ HOST SYNTAX ๐
The general host syntax is [FAMILY:]ADDRESS[:PORT]. Periodt.
FAMILY must be one of the families supported by the -f option. If you don't give it, it defaults to the family given with the -f option โ and if that's also missing, it'll assume either inet or inet6. Heads up though: all host conditions in the expression should either all be the same family, or be only inet and inet6. If there's some other mixture of families, the results will probably be unexpected. ๐ญ Consider yourself warned, bestie.
The form of ADDRESS and PORT depends on the family used. "*" can be used as a wildcard for either the address or the port. Here's the tea for each family:
unixโ ADDRESS is a glob pattern (seefnmatch(3)) that will be matched case-insensitively against the unix socket's address. Both path and abstract names are supported. Unix addresses do not support a port, and"*"cannot be used as a wildcard. ๐linkโ ADDRESS is the case-insensitive name of an Ethernet protocol to match. PORT is either a device name or a device index for the desired link device, as seen in the output ofip link.netlinkโ ADDRESS is a descriptor of the netlink family. Possible values come from/etc/iproute2/nl_protos. PORT is the port id of the socket, which is usually the same as the owning process id. The value"kernel"can be used to represent the kernel (port id of0). ๐งvsockโ ADDRESS is an integer representing the CID address, and PORT is the port.inetandinet6โ ADDRESS is an ip address (either v4 or v6 depending on the family) or a DNS hostname that resolves to an ip address of the required version. An ipv6 address must be enclosed in"["and"]"to disambiguate the port separator. The address may additionally have a prefix length given in CIDR notation (a slash followed by the prefix length in bits). PORT is either the numerical socket port, or the service name for the port to match.
๐ USAGE EXAMPLES ๐
ss -t -a
Display all TCP sockets.
ss -t -a -Z
Display all TCP sockets with process SELinux security contexts.
ss -u -a
Display all UDP sockets.
ss -o state established '( dport = :ssh or sport = :ssh )'
Display all established ssh connections.
ss -x src /tmp/.X11-unix/*
Find all local processes connected to X server.
ss -o state fin-wait-1 '( sport = :http or sport = :https )' dst 193.233.7/24
List all the tcp sockets in state FIN-WAIT-1 for our apache to network 193.233.7/24 and look at their timers. โฑ๏ธ
ss -a -A 'all,!tcp'
List sockets in all states from all socket tables but TCP.
๐ SEE ALSO ๐
ip(8)- RFC 793 - https://tools.ietf.org/rfc/rfc793.txt (TCP states)
๐ AUTHOR ๐
ss was written by Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>.
This manual page was written by Michael Prokop <mika@grml.org> for the Debian project (but may be used by others). absolute icons, the both of them. ๐
And that's the whole SS(8) page, bestie โ SS(8), the one and only, straight from the iproute2 fam, dated like a lil' time capsule at the bottom. Go forth and inspect those sockets, you gorgeous main character. โจ๐ซถ๐ธ
๐ฆ where this page comes from
- arch rolling: iproute2 7.3.0-1 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms