Use ss to list UDP sockets that are listening locally and display numeric values instead of service names.
Which command is appropriate?
ss -lun selects UDP, listening sockets, and numeric addresses and ports.
Detailed explanation
ss -lntIncorrect. It selects TCP listeners.
Incorrect. It selects TCP listeners.
ss -lunCorrect. It lists numeric UDP listeners.
Correct. It lists numeric UDP listeners.
ss -antIncorrect. It lists all TCP sockets.
Incorrect. It lists all TCP sockets.
ss -sIncorrect. It displays a protocol summary.
Incorrect. It displays a protocol summary.
Try it yourself
An example you can run in a temporary verification environment.
ss -lun 2>/dev/null | sed -n '1,3p' || printf '%s
' 'ss command not installed'Expected result
UDP socket一覧のheaderと、存在すれば待受endpointKey points
- -u is UDP
- -l is listening
- -n is numeric
Notes
- Environment: iproute2 ss / 読み取り専用
- 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.