⚡DevCheats
Cloudflare Edge
🐧SysAdmin â€ĸ Linux & Bash CLIVerified for Ubuntu 20.04/22.04/24.04, Debian 12, CentOS/RHELâąī¸ 15 secondsđŸŽ¯ Beginner

Find and Kill Process Running on Specific Port in Linux

Free up occupied ports (e.g., port 3000 or 8080) blocked by zombie node/python processes.

Alex Chen
Alex ChenReviewed by Expert

Staff DevOps & Infrastructure Architect

📖3 min read
â€ĸ
📝430 words
â€ĸ
📅Updated 2026-10-30

Verified Command (Single-Click Copy)

Updated: 2026-10-30
bash
sudo fuser -k 3000/tcp
Share snippet:𝕏in

📋 Prerequisites

State Changing / Caution
  • ✓psmisc package installed
  • ✓sudo privileges

💡 Primary Use Cases

EADDRINUSE Port Collision in Local Dev:

Instantly kill orphan background web server processes.

# How It Works

`fuser -k` immediately sends a SIGKILL to any process bound to the specified TCP port number.

Expected Terminal Output

3000/tcp:            28491
[Process 28491 terminated]
âš ī¸

Gotcha & Common Pitfall

Check which process is running first before killing it blindly using `lsof -i :3000`.

⚡

Performance & Complexity

Time ComplexityO(1)
Space (Memory)O(1)
Mutates OriginalYes (In-Place)

â„šī¸ Terminates OS process immediately.

✓

Environment & Version Support

Ubuntu / Debian
psmisc packageVerified
macOS (Darwin)
lsof + killVerified
Recommended Tool â€ĸ Hetzner Cloud

Reliable Cloud VPS from â‚Ŧ3.50/mo

Ultra-fast NVMe storage, unmetered bandwidth, and Root SSH access in EU & US data centers.

# Alternative Methods & Variations

Inspect first with lsof

See PID and process name before terminating.

bash
sudo lsof -i :3000
kill -9 <PID>

🔍 People Also Ask (Related Quick Answers)

How to see all listening ports in Linux?sudo ss -tulpn
How to find process by name in Linux?pgrep -l process_name
?

Frequently Asked Questions about Find and Kill Process Running on Specific Port in Linux

What if fuser command not found on my system?â–ŧ

Install it via "sudo apt install psmisc" on Ubuntu/Debian or "sudo dnf install psmisc" on Fedora/RHEL.

How do I run this on macOS?â–ŧ

macOS does not have fuser by default. Use: "kill -9 $(lsof -t -i:3000)".

đŸ’ŦWas this snippet helpful for your problem?
← Previous Snippet

Regex for Email Validation in JavaScript

Tags:#linux#port#kill#networking#sysadmin