DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป is a community of 963,503 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for How to Kill a Local Host in Linux
Rabeeh Ebrahim
Rabeeh Ebrahim

Posted on

How to Kill a Local Host in Linux

Sometimes when you try to run a port through terminal, you may end up getting errors like 'address already in use'.

I get this even when I disconnect the host. Although it happens sometimes only. Follow this steps to Kill the local Host.

Step 1:
Open Your Linux Terminal

Step 2:
Types this command below.
sudo lsof -iTCP:3000 -sTCP:LISTEN
Please note that: type your port address instead of 3000

Step 3:
You get an output similar to this.

COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
node    25215  user    20u  IPv6 240148      0t0  TCP *:hbci (LISTEN)
Enter fullscreen mode Exit fullscreen mode

note that PID

Step 4:
type kill 25215

Voila, you killed it :)

Top comments (0)

๐Ÿค” Did you know?

๐ŸŒš You can turn on dark mode in Settings