A powerful CLI tool to check ports, find processes, and manage port usage
Project description
PortMate 🔌
A powerful and intuitive CLI tool to check ports, find processes, and manage port usage. Your friendly port management companion!
Why PortMate?
Every developer has faced this:
- 🚫 "Port 3000 is already in use"
- 🤔 "What process is using this port?"
- 😤 "How do I kill that process?"
- 🔍 "Which ports are currently listening?"
PortMate solves all of this with simple, memorable commands.
Installation
pip install portmate
Quick Start
# Check if a port is in use
portmate 3000
# Check multiple ports at once
portmate 3000 8080 5432
# Kill the process using a port
portmate --kill 3000
# List all listening ports
portmate --list
# Find an available port
portmate --find 3000
# Scan common ports
portmate --scan
Features
✅ Check Ports
Instantly see if a port is in use and what's using it:
portmate 3000
Output:
● Port 3000 is IN USE
Status: LISTEN
PID: 12345
Process: node
User: nikhilesh
🔪 Kill Processes
Stop processes by port number:
portmate --kill 3000
With force kill:
portmate --kill 3000 --force
Skip confirmation:
portmate --kill 3000 --yes
📋 List All Ports
See everything that's listening:
portmate --list
Output:
Port Service Process PID
------ ------------------- --------- ------
3000 Node.js Dev Server node 12345
5432 PostgreSQL postgres 8901
8080 HTTP Alt python 23456
🔍 Scan Ports
Scan a range of ports:
# Scan default range (1-10000)
portmate --scan
# Scan custom range
portmate --scan --start 3000 --end 4000
🎯 Find Available Ports
Find the next available port:
# Find available port starting from 3000
portmate --find 3000
# Check preferred port, find alternative if taken
portmate --find 3000 --preferred 3000
📊 Verbose Mode
Get detailed process information:
portmate 3000 --verbose
Output includes:
- Full executable path
- Process start time
- Complete command line
- Process status
Command Reference
Basic Commands
| Command | Description |
|---|---|
portmate PORT |
Check if port is in use |
portmate PORT1 PORT2 ... |
Check multiple ports |
portmate --list |
List all listening ports |
portmate --scan |
Scan common ports (1-10000) |
portmate --kill PORT |
Kill process using port |
portmate --find START |
Find available port |
Options
| Option | Short | Description |
|---|---|---|
--verbose |
-v |
Show detailed information |
--force |
-f |
Force kill process (SIGKILL) |
--yes |
-y |
Skip confirmation prompts |
--start N |
Start port for scanning | |
--end N |
End port for scanning | |
--preferred PORT |
Preferred port (with --find) | |
--version |
Show version |
Shortcut Alias
Use pm as a shortcut:
pm 3000
pm --list
pm --kill 8080
Use Cases
Web Development
# Check if your dev server port is free
portmate 3000 3001 8080
# Kill the old dev server
portmate --kill 3000
# Find next available port for new service
portmate --find 3000
Database Management
# Check database ports
portmate 5432 3306 27017
# See all database processes
portmate --list --verbose
System Administration
# Scan for open ports
portmate --scan --start 1 --end 1024
# List all services
portmate --list
CI/CD & Testing
# Find available port for test server
PORT=$(portmate --find 8000)
# Clean up test processes
portmate --kill 8000 --yes
Python API
Use PortMate in your Python scripts:
from portmate import check_port, kill_process_by_port, scan_ports
# Check a port
result = check_port(3000)
if result['in_use']:
print(f"Port is used by: {result['name']}")
# Kill a process
success, message = kill_process_by_port(3000)
# Scan ports
used_ports = scan_ports(start_port=3000, end_port=4000)
Requirements
- Python 3.7+
- psutil >= 5.9.0
- colorama >= 0.4.6
- tabulate >= 0.9.0
Platform Support
- ✅ macOS
- ✅ Linux
- ✅ Windows
Common Ports Reference
PortMate recognizes common services:
| Port | Service |
|---|---|
| 80 | HTTP |
| 443 | HTTPS |
| 22 | SSH |
| 3000 | Node.js/React Dev |
| 3306 | MySQL |
| 5432 | PostgreSQL |
| 6379 | Redis |
| 8080 | HTTP Proxy |
| 27017 | MongoDB |
Troubleshooting
Permission Denied
Some operations require elevated privileges:
sudo portmate --kill 80
Port Still in Use After Kill
Try force kill:
portmate --kill 3000 --force
Contributing
Contributions welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details.
Author
Nikhilesh Bezawada
- Email: siddunikhilesh517@gmail.com
- GitHub: @siddu2402
Acknowledgments
Built with:
- psutil - Cross-platform process utilities
- colorama - Colored terminal output
- tabulate - Pretty tables
Like this tool? Star it on GitHub! ⭐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file portmate-0.1.0.tar.gz.
File metadata
- Download URL: portmate-0.1.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71c6f16291fe515634f0d97dc234161e296a2794e4c161ab1c5f77cf1839bdf2
|
|
| MD5 |
ff39ab05ec3b16351a78ae87408141ab
|
|
| BLAKE2b-256 |
f6c48b55964589c2572870ff0e6f4f800c763c56c6387135f471e336787a804b
|
File details
Details for the file portmate-0.1.0-py3-none-any.whl.
File metadata
- Download URL: portmate-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
907108ef6fecee65f4729da1cf0e3678db99622e7e37264ac0e42ddb1681b3be
|
|
| MD5 |
a8d6313adf09db883e46b8580ccb664b
|
|
| BLAKE2b-256 |
84e153bf210d3fb355349091c36ce71a4d9c7fa5ae1b5ab2eb957b2c00734d3d
|