Skip to content

tomenden/port

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

port

See what's running on any port. Kill it if you want.

port interactive TUI

Install

Homebrew:

brew install tomenden/tap/port

curl (system-wide):

sudo curl -sf https://raw.githubusercontent.com/tomenden/port/main/port -o /usr/local/bin/port \
  && sudo chmod +x /usr/local/bin/port

curl (no sudo):

mkdir -p ~/.local/bin
curl -sf https://raw.githubusercontent.com/tomenden/port/main/port -o ~/.local/bin/port \
  && chmod +x ~/.local/bin/port

Make sure ~/.local/bin is in your PATH.

Usage

Just run port:

port

That's it. You get an interactive list of every listening port on your machine. Arrow keys to navigate, K to kill, Q to quit. The selected process expands to show its full command.

More ways to use it

port 3000              # What's on port 3000?
port 3000 8080 5432    # Check multiple ports
port 3000 -k           # Kill whatever's on 3000
port 3000 -kf          # Kill without asking
port --list            # Non-interactive list (great for piping)

Non-interactive output

$ port --list
PORT    PID     USER      UPTIME     COMMAND
------- ------- --------- ---------- -------
3000    14523   tom       2h 34m     node server.js
8080    14601   tom       45m        python -m http.server 8080
5432    891     postgres  3d 12h     /usr/lib/postgresql/16/bin/postgres

Killing

When you press K on a process (or use port <port> -k), it sends SIGTERM first and gives the process 3 seconds to shut down gracefully. If it's still alive after that, SIGKILL finishes the job.

How it works

Single bash script (~380 lines), zero dependencies. Detects your OS and uses the right tool:

  • macOSlsof
  • Linuxss + /proc

Requirements

  • Bash 4+
  • macOS or Linux
  • Some ports may require sudo to see (system processes, ports < 1024)

License

MIT

About

See what's running on any port. Kill it if you want.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages