Skip to content

/errors/ss/is-invalid-family

ss: "ipv4" is invalid family

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: "ipv4" is invalid family means the value given to -f / --family is not a family name ss accepts. ss uses its own names: inet (IPv4), inet6 (IPv6), link (packet sockets), unix, netlink, vsock, tipc and xdp. Use -f inet or the shortcut -4 for IPv4, and select TCP or UDP with -t or -u, not with -f. After the message ss prints its usage text and exits with status 255.

Family names and shortcuts

Wantedss -f valueShort option
IPv4inet-4 (--ipv4)
IPv6inet6-6 (--ipv6)
Packet (raw link-layer) socketslink-0
Unix domain socketsunix-x
Netlink socketsnetlink(none)
VM socketsvsock--vsock
TIPCtipc--tipc
XDP socketsxdp--xdp

ss -f help prints the help text, whose FAMILY := line lists the names your version accepts. The names are matched exactly, so INET is rejected too. Confusingly, --ipv4 and --ipv6 do exist as long options (the same as -4 and -6); only -f ipv4 is wrong.

Protocols are separate options

bash
ss -4 -tln          # IPv4 TCP listening sockets
ss -f inet6 -uan    # all IPv6 UDP sockets
ss -tn -f inet state established
ss -xl              # listening Unix sockets

-t, -u, -w (raw), -S (SCTP), -M (MPTCP) and -x pick the socket tables; -f, -4 and -6 restrict the address family. Combine them as needed.

Sources