Use lsof to list processes and sockets listening on TCP port 8443.
Suppress host and service-name resolution.
Which command is appropriate?
lsof -nP -iTCP:PORT -sTCP:LISTEN narrows to a TCP port in LISTEN state while keeping values numeric.
Detailed explanation
lsof -nP -iTCP:8443Incorrect. It can include non-LISTEN TCP connections.
Incorrect. It can include non-LISTEN TCP connections.
lsof -nP -iUDP:8443Incorrect. It targets UDP.
Incorrect. It targets UDP.
lsof -nP -iTCP:8443 -sTCP:LISTENCorrect. It selects TCP 8443 listeners and numeric output.
Correct. It selects TCP 8443 listeners and numeric output.
lsof +D /proc/8443Incorrect. +D searches an open-file directory, not a port.
Incorrect. +D searches an open-file directory, not a port.
Try it yourself
An example you can run in a temporary verification environment.
lsof -h 2>&1 | grep -E -- '-i|Internet|TCP' | head -n 3Expected result
network address選択に関するhelp行Key points
- -iTCP:PORT
- -sTCP:LISTEN
- -nP suppresses name lookup
Notes
- Environment: lsof help / process変更なし
- 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.