To get pid (Process ID) based on port, use the following command:
Responding to Saad's comment below:
Add '-n' (no host names) and '-P' (no port names) option and remove tcp to get process ID without providing tcp:
lsof -i tcp:80This will return the process ID(s) running this port.
Responding to Saad's comment below:
Add '-n' (no host names) and '-P' (no port names) option and remove tcp to get process ID without providing tcp:
lsof -n -P -i :80
What if I don't give 'tcp'? As in, is there any way of knowing the process id based on port, if we don't know the network level protocol?
ReplyDelete