Skip to content
804384049Public

About

开发时端口被占,一行命令释放。零依赖

Resources

Stars

163 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

portfree

Free a TCP port in one command.

开发时端口被占了?别再手翻 lsof / kill —— 一行搞定。

portfree 3000

Install

curl -fsSL https://raw.githubusercontent.com/YOUR_USER/portfree/main/portfree.py -o ~/.local/bin/portfree
chmod +x ~/.local/bin/portfree

Or just clone and run:

python3 portfree.py 3000

Needs lsof (comes with macOS / most Linux distros).

Usage

# free port 8080 (SIGTERM)
portfree 8080

# force kill (SIGKILL)
portfree 8080 -f

# only list who holds the port
portfree 8080 -n

Example

$ portfree 5173
port 5173 held by:
  • pid 48201  node
sent SIGTERM → pid 48201 (node)
port 5173 is free ✓

Why

  • zero dependencies (stdlib only)
  • one file, ~100 lines
  • safe defaults (SIGTERM, dry-run flag)

License

MIT

About

开发时端口被占,一行命令释放。零依赖

Resources

Stars

163 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages