Use lsof to show only the open socket and process listening on TCP port 443, without resolving names.
Which command is appropriate?
lsof -iTCP:443 -sTCP:LISTEN limits output to the TCP 443 listener; -n and -P suppress host and service-name conversion.
Detailed explanation
lsof -nP -iUDP:443Incorrect. It targets UDP port 443.
Incorrect. It targets UDP port 443.
lsof -nP -iTCP:443 -sTCP:LISTENCorrect. It selects TCP port 443 in LISTEN state and keeps values numeric.
Correct. It selects TCP port 443 in LISTEN state and keeps values numeric.
lsof -nP /tcp/443Incorrect. It is not a valid network selector form.
Incorrect. It is not a valid network selector form.
lsof -iTCP -sUDP:LISTENIncorrect. The TCP selector conflicts with a UDP state selector.
Incorrect. The TCP selector conflicts with a UDP state selector.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '-iTCP:443=TCP port 443' '-sTCP:LISTEN=LISTEN state' '-nP=numeric host and port'Expected result
-iTCP:443=TCP port 443
-sTCP:LISTEN=LISTEN state
-nP=numeric host and portKey points
- Use a network file selector
- Filter the socket state
- Suppress name resolution
Notes
- Environment: lsofのselector対応表
- 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.