| Crates.io | port-checker |
| lib.rs | port-checker |
| version | 0.3.0 |
| created_at | 2025-07-22 03:34:51.344378+00 |
| updated_at | 2025-07-28 02:49:56.530711+00 |
| description | A fast and user-friendly command-line tool to check port usage |
| homepage | https://github.com/william-xue/port-checker |
| repository | https://github.com/william-xue/port-checker |
| max_upload_size | |
| id | 1762936 |
| size | 125,771 |
A fast and user-friendly command-line tool to check port usage on your system. Built with Rust for maximum performance and reliability.
cargo install port-checker
git clone https://github.com/william-xue/port-checker.git
cd port-checker
cargo install --path .
Download the latest release from the releases page.
# List all ports
port-checker list
# List only TCP ports
port-checker list --protocol tcp
# List only listening ports
port-checker list --listening
# Output in different formats
port-checker list --format json
port-checker list --format yaml
port-checker list --format csv
port-checker list --format table # default
# Check port 8080 (both TCP and UDP)
port-checker check 8080
# Check port 8080 TCP only
port-checker check 8080 --protocol tcp
# Find process using TCP port 8080
port-checker find 8080
# Find process using UDP port 53
port-checker find 53 --protocol udp
# Kill process using TCP port 8080
port-checker kill 8080
# Kill process using UDP port 53
port-checker kill 53 --protocol udp
port-checker stats
# Allocate a random available port in range
port-checker pick --start 8000 --end 9000
# Keep the port reserved (don't exit immediately)
port-checker pick --start 8080 --end 8090 --keep
# Reserve a port temporarily
port-checker reserve 8888
# Reserve a port and run a command with it
port-checker reserve 8888 --command "python3 -m http.server"
# Keep the port reserved after command exits
port-checker reserve 8888 --command "node server.js" --keep
# Show current configuration
port-checker config show
# Initialize default configuration file
port-checker config init
# Use custom configuration file
port-checker list --config /path/to/config.toml
# Override settings with command line options
port-checker list --format yaml --verbose
$ port-checker list --listening
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโฌโโโโโโโโโโโโโโโ
โ Protocol โ Local Address โ Remote Address โ State โ PID โ Process Name โ
โโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโผโโโโโโโโโโโโโโโค
โ TCP โ 0.0.0.0:22 โ - โ LISTEN โ 1234 โ sshd โ
โ TCP โ 127.0.0.1:5432 โ - โ LISTEN โ 5678 โ postgres โ
โ TCP โ 0.0.0.0:80 โ - โ LISTEN โ 9012 โ nginx โ
โ TCP โ 0.0.0.0:443 โ - โ LISTEN โ 9012 โ nginx โ
โโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโดโโโโโโโโโโดโโโโโโโดโโโโโโโโโโโโโโโ
Total: 4 ports found
$ port-checker check 8080
๐ข Port 8080 (TCP) is FREE
๐ข Port 8080 (UDP) is FREE
$ port-checker find 22
๐ Process using port 22 (TCP):
Process ID: 1234
Process Name: sshd
Local Address: 0.0.0.0:22
State: LISTEN
$ port-checker pick --start 8080 --end 8090
๐ฒ Allocating random port in range 8080..8090
โ
Successfully allocated port: 8085
Address: 127.0.0.1:8085
Protocol: TCP
โก Port 8085 allocated successfully. Use it quickly before this program exits!
๐ก Press Enter to release the port...
$ port-checker reserve 8888 --command "python3 -m http.server"
๐ Reserving port 8888 (TCP)
โ
Port 8888 successfully reserved
๐ Starting command: python3 -m http.server
โ
Command started with PID: 12345
โณ Waiting for command to complete...
Serving HTTP on 0.0.0.0 port 8888 (http://0.0.0.0:8888/) ...
These options are available for all commands:
-f, --format <FORMAT>: Output format (table, json, yaml, csv)-c, --config <FILE>: Use custom configuration file-v, --verbose: Enable verbose outputport-checker list [OPTIONS]List all occupied ports on the system.
Options:
-p, --protocol <PROTOCOL>: Filter by protocol (tcp/udp)-l, --listening: Show only listening portsport-checker check <PORT> [OPTIONS]Check if a specific port is in use.
Arguments:
<PORT>: Port number to checkOptions:
-p, --protocol <PROTOCOL>: Protocol to check (tcp/udp)port-checker find <PORT> [OPTIONS]Find the process using a specific port.
Arguments:
<PORT>: Port number to findOptions:
-p, --protocol <PROTOCOL>: Protocol type (default: tcp)port-checker kill <PORT> [OPTIONS]Kill the process using a specific port.
Arguments:
<PORT>: Port number to find the process to killOptions:
-p, --protocol <PROTOCOL>: Protocol type (default: tcp)port-checker statsDisplay port usage statistics.
port-checker pick [OPTIONS]Allocate a random available port in specified range.
Options:
-s, --start <START>: Start of port range (default: 8000)-e, --end <END>: End of port range (default: 9000)-k, --keep: Keep the port reserved (don't exit immediately)port-checker reserve <PORT> [OPTIONS]Reserve a specific port and optionally run a command.
Arguments:
<PORT>: Port number to reserveOptions:
-p, --protocol <PROTOCOL>: Protocol (tcp/udp) (default: tcp)-c, --command <COMMAND>: Command to run with the reserved port-k, --keep: Keep the port reserved after command exitsport-checker config <ACTION>Manage configuration settings.
Actions:
show: Display current configurationinit: Create default configuration file at ~/.config/port-checker/config.tomlset: Set configuration values (planned feature)Port Checker supports configuration files in TOML format. The default location is ~/.config/port-checker/config.toml.
# Default output format
default_format = "Table" # Table, Json, Yaml, Csv
# Scan timeout in seconds
scan_timeout = 30
# Number of concurrent threads for scanning
concurrent_threads = 4
# Enable verbose output by default
verbose = false
# Show process information
show_process_info = true
# Default reserve duration in seconds
default_reserve_duration = 3600 # 1 hour
# Port allocation range
[port_range]
start = 8000
end = 9000
--config~/.config/port-checker/config.toml)netstat and tasklist commands (included by default)Port Checker is designed to be fast and lightweight:
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)This project is licensed under the MIT License - see the LICENSE.md file for details.
ๆไปฌๆญฃๅจ็งฏๆๅผๅไปฅไธ้ซ็บงๅ่ฝ๏ผ่ฎฉ Port Checker ๆไธบๆดๅผบๅคง็็ฝ็ป่ฏๆญๅทฅๅ ท๏ผ
# ๆซๆ็ฝๆฎต็็ซฏๅฃ่ๅด
port-checker scan 192.168.1.0/24 --ports 1-1000
# ไฝฟ็จ้ข่ฎพๆซๆๅธธ่งๆๅก็ซฏๅฃ
port-checker scan --preset web
port-checker scan --preset database
# ๆ็ปญ็ๆงๆๅฎ็ซฏๅฃ
port-checker monitor --watch 80,443 --alert
# ๅฎๆถไปช่กจๆฟ
port-checker dashboard --refresh 1s
# ่ฏๅซ็ซฏๅฃไธ่ฟ่ก็ๆๅก
port-checker identify 80 --fingerprint
# ๅฅๅบทๆฃๆฅ้ข่ฎพๆๅก
port-checker health-check --preset database
่ฟไบๅ่ฝๅฐๅจๅ็ปญ็ๆฌไธญ้ๆญฅๅๅธ๏ผๆฌ่ฏทๆๅพ ๏ผ
If you encounter any issues or have questions, please open an issue on GitHub.