https://github.com/doganarif/portfinder
A fast, lightweight Go-based CLI tool to detect and manage processes using network portsβfeaturing project awareness, Docker support, and an interactive terminal UI.
https://github.com/doganarif/portfinder
cli go networking ports
Last synced: 4 months ago
JSON representation
A fast, lightweight Go-based CLI tool to detect and manage processes using network portsβfeaturing project awareness, Docker support, and an interactive terminal UI.
- Host: GitHub
- URL: https://github.com/doganarif/portfinder
- Owner: doganarif
- License: mit
- Created: 2025-06-04T22:58:18.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-06-04T23:29:44.000Z (4 months ago)
- Last Synced: 2025-06-05T04:13:53.066Z (4 months ago)
- Topics: cli, go, networking, ports
- Language: Go
- Homepage:
- Size: 125 KB
- Stars: 5
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pf
A modern CLI tool to identify and manage processes using network ports.
Built with Go for speed, clarity, and zero runtime dependencies.

## π¬ Preview

---
## β¨ Features
- π **Smart Process Detection** β Instantly find what's using your ports
- π **Project Awareness** β Shows which project/directory owns the process
- π³ **Docker Support** β Identifies containerized processes
- π― **Quick Actions** β Kill processes interactively or directly
- π **Port Overview** β Check all common development ports
- π **Fast & Lightweight** β Single binary, no runtime dependencies---
## π¦ Installation
### β Using Homebrew (macOS/Linux)
```bash
brew tap doganarif/tap
brew install pf
```### πͺ Windows
Download the latest `.exe` file from the [Releases Page](https://github.com/doganarif/portfinder/releases):
- For 64-bit Windows: `pf-windows-amd64.exe`
- For ARM64 Windows: `pf-windows-arm64.exe`Rename it to `pf.exe` and add to your PATH.
### π§° Using Go
```bash
go install github.com/doganarif/portfinder/cmd/portfinder@latest
```This installs the binary as `pf`.
### π Download Binary
Grab the latest release from the [Releases Page](https://github.com/doganarif/portfinder/releases).
---
## π§ͺ Usage
### π Check a specific port
```bash
pf 3000
```Output:
```
π Port 3000 is in use by:Process node
PID 48291
Command npm run dev
Project ~/projects/my-react-app
Started 3 hours agoKill this process? [y/n]
```---
### π Check common development ports
```bash
pf check
```Example output:
```
π Common Development Ports:Frontend:
β 3000: node (my-react-app)
β 3001: free
β 4200: free
β 5173: vite (my-vue-app)
β 8080: freeBackend:
β 4000: free
β 5000: python (flask-api)
β 8000: free
β 9000: freeDatabases:
β 3306: free
β 5432: postgres (docker)
β 6379: redis
β 27017: free
```---
### π List all ports in use
```bash
pf list
```---
### π Kill a process
```bash
pf kill 3000
```---
## βοΈ Common Ports Reference
| Port | Common Use |
| ----- | ------------------------- |
| 3000 | React, Node.js, Rails |
| 3001 | Create React App fallback |
| 4200 | Angular |
| 5173 | Vite |
| 5000 | Flask, Python servers |
| 8000 | Django |
| 8080 | General web development |
| 3306 | MySQL/MariaDB |
| 5432 | PostgreSQL |
| 6379 | Redis |
| 27017 | MongoDB |
| 9200 | Elasticsearch |
| 9090 | Prometheus |
| 3100 | Grafana Loki |
| 8983 | Solr |---
## π οΈ Configuration
You can override the default list of common ports by creating a config file at:
```bash
~/.config/portfinder/config.json
```Example:
```json
{
"common_ports": [3000, 3001, 5173, 5000, 8000]
}
```---
## π§βπ» Development
### Prerequisites
- Go 1.21+
- Make (optional)### Building from source
```bash
# Clone the repository
git clone https://github.com/doganarif/portfinder.git
cd portfinder# Build
make build# Run tests
make test# Install locally
make install
```---
## π Project Structure
```
pf/
βββ cmd/
β βββ portfinder/ # CLI entry point
βββ internal/
β βββ config/ # Configuration management
β βββ process/ # Process detection logic
β βββ ui/ # Terminal UI components
βββ Makefile # Build automation
βββ README.md # This file
```---
## π€ Contributing
Contributions are welcome! Please open an issue or pull request.
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request---
## π License
This project is licensed under the MIT License β see the [LICENSE](LICENSE) file.
---
## π Acknowledgments
- Inspired by the frustration of "port already in use" errors
- Built using [Cobra](https://github.com/spf13/cobra) for CLI
- Terminal UI powered by [Bubbletea](https://github.com/charmbracelet/bubbletea)---
## π§ Author
**Arif DoΔan**
- GitHub: [@doganarif](https://github.com/doganarif)
- Twitter: [@arifcodes](https://twitter.com/arifcodes)> If you find this tool useful, please consider giving it a βοΈ on GitHub!