portfind-cli
v1.0.0
Published
Find what's using a port, kill it, or find an open port
Maintainers
Readme
portfind-cli
Find what's using a port, kill it, or find an open port. Zero dependencies.
Developers constantly run into "port already in use" errors. portfind gives you instant answers and quick fixes from the command line.
Installation
npm install -g portfind-cliUsage
Check what's using a port
portfind 3000Shows the process name, PID, and user occupying port 3000.
Kill the process on a port
portfind 3000 --killFinds the process using port 3000 and terminates it.
Find an available port
portfind --freeReturns a random available port.
portfind --free 3000Finds the next available port starting from 3000. Useful when your preferred port is taken.
Scan a port range
portfind --scan 3000-3010Scans ports 3000 through 3010 and reports which are in use and which are free.
List all listening ports
portfind --listDisplays every listening port on your machine along with its process name and PID.
Platform Support
| Platform | Method |
|----------|--------|
| macOS | lsof |
| Linux | lsof |
| Windows | netstat |
Examples
$ portfind 8080
PORT PID PROCESS USER
8080 12345 node tate
$ portfind --scan 3000-3005
Scanning ports 3000-3005...
PORT STATUS PID PROCESS
3000 IN USE 12345 node
3001 FREE - -
3002 FREE - -
3003 IN USE 12400 python3
3004 FREE - -
3005 FREE - -
3 free, 2 in use
$ portfind --free 8080
Port 8080 is available.Requirements
- Node.js >= 14.0.0
- No external dependencies
License
MIT - Tate Lyman
