Difference between revisions of "Port to PID"
From Noah.org
Jump to navigationJump to searchLine 1: | Line 1: | ||
[[Category:Engineering]] | [[Category:Engineering]] | ||
[[Category:Networking]] | [[Category:Networking]] | ||
− | Use the `lsof` command to find which process is listening on a given port | + | Use the `lsof` command to find which process is listening on a given port. |
− | For example, I saw that some process was already using port 69 (normally TFTP). | + | For example, I saw that some process was already using port 69 (normally TFTP). I did not expect this port to be in use, so I ran the following command to find out which process what listening on port 69: |
<pre> | <pre> | ||
Line 18: | Line 18: | ||
<pre> | <pre> | ||
lsof -u USER | lsof -u USER | ||
+ | </pre> | ||
+ | |||
+ | <pre> | ||
lsof -c COMMAND | lsof -c COMMAND | ||
</pre> | </pre> |
Revision as of 16:55, 28 August 2008
Use the `lsof` command to find which process is listening on a given port.
For example, I saw that some process was already using port 69 (normally TFTP). I did not expect this port to be in use, so I ran the following command to find out which process what listening on port 69:
lsof -i :69
To look for http:
lsof -i :80
You can also look for files opened by a given user or command:
lsof -u USER
lsof -c COMMAND