A TUI and CLI tool for managing local and remote ports via SSH. Quickly identify which process is hogging a port and kill it instantly.
- π‘ Live Port Monitor - Real-time table displaying ports, protocols (TCP/UDP), PIDs, process names, CPU%, and memory usage
- π TCP & UDP Support - Scans both TCP and UDP listening ports using multiple detection methods
- π Remote Monitoring - Monitor ports on remote servers via SSH
- π» CLI Mode - Use
describeandkillcommands for quick operations without TUI - β¨οΈ Interactive Navigation - Vim-style navigation with arrow keys or
j/k - π Process Termination - Kill processes directly from the TUI or CLI with a single command
- π Regex Filtering - Filter ports by name, PID, or port number with regex support
- π§ Zombie Detection - Automatically highlights suspicious processes (high CPU + orphaned) in red
- π¨ K9s-Inspired UI - Beautiful dark theme with color-coded information
brew install subediparas5/tap/lsportcurl -fsSL https://subediparas5.github.io/lsport/install.sh | bashOr manually:
# Add GPG key and repository
curl -fsSL https://subediparas5.github.io/lsport/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/lsport.gpg
echo "deb [signed-by=/usr/share/keyrings/lsport.gpg arch=$(dpkg --print-architecture)] https://subediparas5.github.io/lsport stable main" | sudo tee /etc/apt/sources.list.d/lsport.list
sudo apt update && sudo apt install lsportcargo install lsportgit clone https://github.com/subediparas5/lsport.git
cd lsport
cargo build --release
sudo cp target/release/lsport /usr/local/bin/Download pre-built binaries from GitHub Releases.
Lsport supports two modes: TUI mode (default) for interactive monitoring and CLI mode for quick operations.
# Monitor localhost (default)
lsport
# For killing system processes, you may need sudo
sudo lsport
# Monitor a remote server via SSH
lsport --host user@example.com
# Remote server with custom SSH port
lsport --host user@example.com:2222
# Use a specific SSH key
lsport --host user@example.com -i ~/.ssh/my_key
# Custom scan interval (5 seconds)
lsport -s 5Get detailed information about a port or process:
# Describe a port
lsport describe 8080
# Describe a PID
lsport describe 12345
# Describe on remote server
lsport describe -H user@example.com 8080
# Use specific SSH key
lsport describe -H user@example.com -i ~/.ssh/my_key 8080Output includes:
- Port number and protocol (TCP/UDP)
- Process ID (PID)
- Process name
- CPU usage percentage
- Memory usage
- Parent process status
- Zombie process detection
Kill a process by PID or port number:
# Kill process by port
lsport kill --port 8080
# Kill process by PID
lsport kill --pid 12345
# Force kill (SIGKILL instead of SIGTERM)
lsport kill --port 8080 --force
# Kill on remote server
lsport kill --port 8080 -H user@example.com
# Force kill on remote server
lsport kill --pid 12345 -H user@example.com --forceNote:
- You must specify either
--pidor--port, but not both - If multiple processes are found on a port, lsport will list them and ask you to use
--pidto specify which one to kill
| Option | Description |
|---|---|
-H, --host <HOST> |
Remote host (format: user@host:port or user@host or host) |
-i, --identity <PATH> |
Path to SSH private key |
-s, --scan-interval <SECS> |
Scan interval in seconds (default: 2) |
-h, --help |
Print help |
-V, --version |
Print version |
| Command | Option | Description |
|---|---|---|
describe |
-H, --host <HOST> |
Remote host to query |
describe |
-i, --identity <PATH> |
Path to SSH private key |
kill |
--pid <PID> |
Kill process by PID (required if --port not specified) |
kill |
--port <PORT> |
Kill process by port number (required if --pid not specified) |
kill |
-H, --host <HOST> |
Remote host to query |
kill |
-i, --identity <PATH> |
Path to SSH private key |
kill |
-f, --force |
Force kill (SIGKILL instead of SIGTERM) |
| Key | Action |
|---|---|
β / k |
Move selection up |
β / j |
Move selection down |
PgUp |
Move up 10 rows |
PgDn |
Move down 10 rows |
Home |
Go to first entry |
End |
Go to last entry |
Enter |
Kill selected process |
/ |
Enter filter mode (supports regex!) |
c |
Connect to remote host |
d |
Disconnect from remote host |
? |
Toggle help popup |
Esc |
Clear filter / Close help |
q |
Quit |
| Key | Action |
|---|---|
Shift+P / 1 |
Sort by Port |
Shift+O / 2 |
Sort by Protocol |
Shift+I / 3 |
Sort by PID |
Shift+N / 4 |
Sort by Name |
Shift+C / 5 |
Sort by CPU % |
Shift+M / 6 |
Sort by Memory |
Press the same key again to toggle ascending/descending order.
You can connect to a remote server directly from the TUI:
- Press
cto enter connect mode - Enter the host (format:
user@host:portoruser@hostorhost) - Press
Enterto optionally specify an SSH key path, orTabto skip - Press
Enteragain to connect
Disconnect: Press d while connected to return to local monitoring.
SSH Authentication: Authentication is attempted in this order:
- Specified key (if provided during connect)
- SSH agent (if running)
- Default keys:
~/.ssh/id_ed25519,~/.ssh/id_rsa,~/.ssh/id_ecdsa
Press / to enter filter mode. Filters support:
- Simple text:
nodematches any entry containing "node" - Regex patterns:
^80[0-9]{2}$matches ports 8000-8099 - Case-insensitive: All filters are case-insensitive
The context bar shows "Regex:" when your filter is a valid regex pattern.
# Quick check: What's using port 8080?
lsport describe 8080
# Kill a process blocking port 3000
lsport kill --port 3000
# Kill a process by PID
lsport kill --pid 12345
# Force kill a stuck process
lsport kill --pid 12345 --force
# Check remote server
lsport describe -H user@server.com 22
# Kill process on remote server by port
lsport kill --port 8080 -H user@server.com
# Kill process on remote server by PID
lsport kill --pid 12345 -H user@server.com --forceLsport features a k9s-inspired terminal UI with:
- π¨ Dark theme with blue/cyan accents
- π Clean table with alternating row colors
- π Sort indicators in column headers
[P/1]β² - β¨οΈ Vim-style command bar at bottom
- π Help popup (
?) with full keybinding reference - π·οΈ Color-coded protocols (TCP=blue, UDP=green) and CPU usage
- Rust 1.88.0 or later
- OpenSSL development libraries (for SSH support)
# Install pre-commit hooks
./scripts/setup-hooks.sh
# Or manually with pre-commit
pip install pre-commit
pre-commit install
pre-commit install --hook-type pre-push# Debug build
cargo build
# Release build
cargo build --release
# Run tests
cargo test
# Run clippy
cargo clippy --all-targets --all-features -- -D warnings
# Format code
cargo fmtsrc/
βββ main.rs # Entry point, CLI parsing & event loop
βββ app.rs # Model - Application state management
βββ scanner.rs # Local port scanning & process correlation
βββ remote.rs # SSH remote scanning module
βββ ui.rs # View - Ratatui rendering logic
# Patch release (0.1.0 β 0.1.1)
./scripts/release.sh patch
# Minor release (0.1.0 β 0.2.0)
./scripts/release.sh minor
# Major release (0.1.0 β 1.0.0)
./scripts/release.sh major| Crate | Purpose |
|---|---|
| ratatui | TUI framework |
| crossterm | Terminal backend |
| sysinfo | System/process information |
| listeners | Port to PID mapping |
| ssh2 | SSH remote connections |
| clap | CLI argument parsing |
| regex | Filter pattern matching |
| anyhow | Error handling |
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
For security concerns, please see SECURITY.md.
MIT License - see LICENSE for details.