Skip to content

/errors/ss/wrong-state-name

ss: wrong state name: listen

The commands on this page have not been executed by our verification runner yet.updated
tool
ss / netstat
exit code
255
versions
iproute2 5.x, iproute2 6.x
os
linux

ss: wrong state name: listen means the word after state (or exclude) is not one of the names ss knows. ss uses lowercase names with hyphens (time-wait, close-wait, syn-sent), not the netstat spellings (TIME_WAIT), and the listening state is called listening, not listen. Matching is case-insensitive, so the problem is the spelling, not upper case. For listening sockets, ss -l is the usual form.

Valid state names

The list below comes from scan_state() in iproute2's misc/ss.c:

Name to useTCP stateCommon wrong forms
establishedESTABLISHEDestab (ss prints ESTAB, but the filter needs established)
syn-sentSYN_SENTsyn_sent
syn-recv (or syn-rcv)SYN_RECVsyn_recv
fin-wait-1, fin-wait-2FIN_WAIT1, FIN_WAIT2fin_wait1
time-waitTIME_WAITtime_wait, timewait
close-waitCLOSE_WAITclose_wait
last-ackLAST_ACKlast_ack
closingCLOSING
listeningLISTENlisten
closed (or close, unconnected)CLOSE
bound-inactivebound but inactive sockets (recent kernels)

Group names: all, connected (all except listening and closed), synchronized (connected except syn-sent), bucket (syn-recv and time-wait, the minisocket states), big (all except bucket states).

Correct commands

bash
ss -tn state established
ss -tn state time-wait '( dport = :443 )'
ss -tn state close-wait
ss -tln                         # listening TCP sockets
ss -tn exclude established      # everything except established

state can be repeated (state fin-wait-1 state fin-wait-2). ss exits with status 255 on this error and prints nothing else.

Sources