List all local UDP sockets numerically and show owning processes where permitted.
Use ss.
Which command is appropriate?
ss -uanp combines UDP, all states, numeric output, and process information. Process details may require appropriate privileges.
Detailed explanation
ss -lntpIncorrect. It is restricted to listening TCP sockets.
Incorrect. It is restricted to listening TCP sockets.
ss -xapIncorrect. It targets UNIX-domain sockets.
Incorrect. It targets UNIX-domain sockets.
ss -uanpCorrect. The options select all UDP sockets numerically with process information.
Correct. The options select all UDP sockets numerically with process information.
ss -rIncorrect. -r does not provide the requested UDP and process filters.
Incorrect. -r does not provide the requested UDP and process filters.
Try it yourself
An example you can run in a temporary verification environment.
ss -uan 2>/dev/null | sed -n '1,5p' || printf '%s
' 'ss is not installed'Expected result
UDPソケット一覧、またはss未導入メッセージKey points
- -u selects UDP
- -a includes all states
- -n numeric and -p process info
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.