Created
June 13, 2019 07:17
-
-
Save NguyenTrungTin/7b4af2d2e451483d2bbd2f2753606640 to your computer and use it in GitHub Desktop.
How to know what program is listening on a given port?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Open your terminal and type as | |
```sh | |
lsof -i :8000 | |
``` | |
For example, with port 8000 (python3 -m http.server): | |
```sh | |
$ lsof -i :8000 | |
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME | |
python3 3269 user 3u IPv4 1783216 0t0 TCP *:8000 (LISTEN) | |
And port 22 (SSH): | |
``` | |
```sh | |
$ sudo lsof -i :22 | |
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME | |
sshd 998 root 3u IPv4 1442116 0t0 TCP *:ssh (LISTEN) | |
sshd 998 root 4u IPv6 1442118 0t0 TCP *:ssh (LISTEN) | |
```sh | |
fuser 43796/tcp | |
``` | |
https://askubuntu.com/questions/278448/how-to-know-what-program-is-listening-on-a-given-port | |
https://askubuntu.com/questions/227161/how-can-we-find-which-process-is-using-a-particular-port | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment