File size: 1,111 Bytes
f8bf7df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Helper for controling ports. Example is for port 8000.

### On Windows:

Open Command Prompt as an administrator.

Run the following command to find out which process is using port 8000:
```
netstat -ano | findstr :8000
```

Look for the line that has 0.0.0.0:8000 or [::]:8000 and note the PID (Process Identifier) at the end of that line.

To find out which application the PID corresponds to, run:
```
tasklist /fi "pid eq <PID>"
```
Replace <PID> with the actual PID number.

Once you know which application is using the port, you can decide if you want to close it. If you do, you can either close the application normally or use the following command to forcefully terminate the process:
```
taskkill /PID <PID> /F
```
Again, replace <PID> with the actual PID number.


### On macOS and Linux:


Open Terminal.

Run the following command to find out which process is using port 8000:
```
sudo lsof -i :8000
```

Look for the PID in the output, which is usually in the second column.

To stop the process, you can use the kill command:
```
sudo kill -9 <PID>
```
Replace <PID> with the actual PID number.