Display listening TCP and UDP sockets numerically and show the owning processes where permitted.
Which command is appropriate?
ss -tulpn selects TCP and UDP, listening sockets, process information, and numeric addresses and ports.
Detailed explanation
ss -lntIncorrect. It shows TCP listeners only and omits UDP and process information.
Incorrect. It shows TCP listeners only and omits UDP and process information.
ss -antupIncorrect. It includes TCP, UDP, and processes but does not restrict output to listeners.
Incorrect. It includes TCP, UDP, and processes but does not restrict output to listeners.
ss -tulpnCorrect. It combines TCP, UDP, listening, process, and numeric filters.
Correct. It combines TCP, UDP, listening, process, and numeric filters.
ss -lxpnIncorrect. It targets UNIX sockets rather than TCP and UDP.
Incorrect. It targets UNIX sockets rather than TCP and UDP.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '-t=TCP' '-u=UDP' '-l=listening' '-p=process' '-n=numeric'Expected result
-t=TCP
-u=UDP
-l=listening
-p=process
-n=numericKey points
- Select TCP and UDP
- -p shows processes
- Privileges can limit process details
Notes
- Environment: iproute2 ssのoption対応表
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.