Find a process on a port
Read-only
What do risk levels mean?
- Read-only
- Inspects state without changing anything.
- Low risk
- Reversible with a routine follow-up command.
- Medium risk
- Changes state; undo path documented.
- Destructive
- Deletes or overwrites; confirmation required.
Identifies the local process listening on a TCP port without changing the process or network configuration.
networkportprocess
Parameters
Local TCP port to inspect.
Commands
List the process listening on the selected TCP port
lsof -nP -iTCP:<port> -sTCP:LISTENVerification
lsof -nP -iTCP:<port> -sTCP:LISTENA listener is shown, or the command returns no rows when the port is free.
Undo
Not undoable
This recipe only reads process information and changes nothing.
Pitfalls
- Details for processes owned by another user may require elevated access.