Skip to content

Q&A · Answered

How to find and kill a process using a specific port

asked 9 months, 1 week ago 1999 views 1 answer
14

I need to free up port 8000 but something is already using it. How can I find what process is using it and kill it?

1 Answer

One accepted
16

Accepted answer

Not confirmed since it was written, 9 months, 1 week ago

Find process using port

# Using lsof
sudo lsof -i :8000

# Using netstat
sudo netstat -tlnp | grep :8000

# Using ss
sudo ss -tlnp | grep :8000

Kill the process

# Kill by PID
kill -9 PID_NUMBER

# Kill all processes on port (one-liner)
sudo fuser -k 8000/tcp

Your answer

Say what you tried, not only what worked — the next person needs the reasoning. Code goes in a fenced block.

Shown beside your answer and never checked, so it cannot be a name someone already has here.

No account needed to answer. Sign in instead and it carries your name and earns reputation.