[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-80203":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":12,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":14,"stars7d":14,"stars30d":15,"stars90d":12,"forks30d":12,"starsTrendScore":16,"compositeScore":12,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":17,"topics":20,"createdAt":9,"pushedAt":9,"updatedAt":21,"readmeContent":22,"aiSummary":23,"trendingCount":12,"starSnapshotCount":12,"syncStatus":14,"lastSyncTime":24,"discoverSource":25},80203,"portcop","Hawila\u002Fportcop","Hawila","your cross-platform port detective 🚔 — find, inspect, and kill processes by port",null,"JavaScript",78,0,72,2,5,6,false,"main",true,[],"2026-06-12 02:03:59","# portcop 🚔\n\n> Your cross-platform port detective — find, inspect, and kill processes by port number or process name.\n\nNo dependencies. Works on **macOS**, **Linux**, and **Windows**.\n\n---\n\n## Why\n\nEvery fullstack developer has googled `lsof -i :3000` at least once a week. `portcop` makes it one clean command that works everywhere — no memorizing OS-specific flags, no piping through grep, no copy-pasting PIDs.\n\n---\n\n## Install\n\n```bash\nnpm install -g portcop\n```\n\n---\n\n## Usage\n\n### Check what's on a port\n\n```bash\nportcop 3000\n```\n\n```\n  Checking port 3000...\n\n  ✘ Port 3000 is occupied\n\n    Process : node\n    PID     : 8421\n    Command : node server.js\n\n  Kill it? (y\u002Fn)\n```\n\n---\n\n### Kill immediately without prompt\n\n```bash\nportcop 3000 --kill\n```\n\n```\n  ✔ Killed node (PID 8421)\n```\n\n---\n\n### Check multiple ports at once\n\n```bash\nportcop 3000 4000 5000\n```\n\n```\n  ✘ Port 3000 → node  PID 8421  node server.js\n  ✔ Port 4000 is free\n  ✘ Port 5000 → python  PID 9103  python app.py\n\n  Kill all 2 occupied? (y\u002Fn)\n```\n\n---\n\n### List all occupied ports\n\n```bash\nportcop ls\n```\n\n```\n  Scanning all occupied ports...\n\n  3000  node            PID 8421    node server.js\n  5173  node            PID 9103    node vite.js\n  8080  python          PID 9210    python manage.py runserver\n\n  3 ports occupied\n```\n\n---\n\n### Find processes by name\n\n```bash\nportcop -n node\n```\n\n```\n  Searching for processes matching \"node\"...\n\n  Found 3 processes matching \"node\"\n\n  ✘ Port 3000  node  PID 8421\n     node server.js\n  ✘ Port 5173  node  PID 9103\n     node vite.js\n  ✘ Port 8080  node  PID 9210\n     node webpack.js\n\n  Kill all 3?  y \u002F n \u002F ports (e.g. 3000,5173,8080)\n```\n\nAt the prompt you can:\n- `y` — kill all matching processes\n- `n` — cancel, no action taken\n- `3000` — kill a single port only\n- `3000,5173` — kill specific ports, leave the rest running\n\n---\n\n### Kill all processes by name (no prompt)\n\n```bash\nportcop -n node --kill\n```\n\n```\n  ✔ Killed node (PID 8421)\n  ✔ Killed node (PID 9103)\n  ✔ Killed node (PID 9210)\n```\n\n---\n\n### Check if a port is free\n\n```bash\nportcop free 3000\n```\n\n```\n  ✔ Port 3000 is free\n```\n\n---\n\n### Find first free port in a range\n\n```bash\nportcop free 3000-3010\n```\n\n```\n  Scanning ports 3000–3010...\n  ✔ First free port: 3003\n```\n\n---\n\n### Find next N free ports\n\n```bash\nportcop free 3000+ --count 5\n```\n\n```\n  Finding 5 free ports from 3000...\n  ✔ 3000\n  ✔ 3001\n  ✔ 3003\n  ✔ 3005\n  ✔ 3006\n```\n\n---\n\n## How it works\n\n**macOS:** uses `lsof`\n\n**Linux:** tries 3 strategies in order, using the first one that works:\n1. `lsof` — available on most distros\n2. `ss` — modern replacement for netstat, used when lsof isn't installed\n3. `\u002Fproc\u002Fnet\u002Ftcp` — pure Linux kernel file, no tools needed at all. Works in Docker containers, CI runners, and minimal environments where nothing is installed\n\n**Windows:** chains `netstat -ano` → `tasklist` (no single command gives port + process name together)\n\n| OS            | Kill              |\n|---------------|-------------------|\n| macOS \u002F Linux | `kill -9 PID`     |\n| Windows       | `taskkill \u002FPID \u002FF`|\n\nAll OS differences are abstracted away. The CLI output is identical everywhere.\n\n> **Note:** On some systems, killing processes on privileged ports (\u003C 1024) may require `sudo`.\n\n---\n\n## Options\n\n| Flag        | Alias | Description                          |\n|-------------|-------|--------------------------------------|\n| `--kill`    | `-k`  | Kill without confirmation prompt     |\n| `--name`    | `-n`  | Search by process name               |\n| `--count N` |       | Number of free ports to find         |\n| `--help`    | `-h`  | Show help                            |\n\n---\n\n## Commands\n\n| Command                          | Description                              |\n|----------------------------------|------------------------------------------|\n| `portcop \u003Cport>`                 | Check who is using a port                |\n| `portcop \u003Cport> --kill`          | Kill the process without asking          |\n| `portcop \u003Cp1> \u003Cp2> \u003Cp3>`        | Check multiple ports at once             |\n| `portcop ls`                     | List all occupied ports                  |\n| `portcop -n \u003Cname>`              | Find all ports used by a process name    |\n| `portcop -n \u003Cname> --kill`       | Kill all processes matching a name       |\n| `portcop free \u003Cport>`            | Check if a port is free                  |\n| `portcop free \u003Cstart>-\u003Cend>`     | Find first free port in range            |\n| `portcop free \u003Cport>+ --count N` | Find next N free ports starting from port|\n\n---\n\n## Testing\n\n```bash\nnode test.js\n```\n\nThe test suite spins up real TCP servers to verify behavior end-to-end, with zero test framework dependencies.\n\n---\n\n## License\n\nMIT","portcop 是一个跨平台的端口检测工具，可以帮助用户查找、检查并终止指定端口上的进程。其核心功能包括通过端口号或进程名称来发现和管理占用特定端口的服务，支持 macOS、Linux 和 Windows 系统，无需额外依赖。该工具特别适合于全栈开发者在开发过程中遇到端口冲突时快速定位问题源头，并采取相应措施释放所需资源。使用简单直观的命令行界面，portcop 能够执行如检查单个或多个端口状态、列出所有被占用端口、根据名称搜索进程以及自动寻找空闲端口等任务，极大简化了跨操作系统环境下的网络调试工作流程。","2026-06-11 03:59:39","CREATED_QUERY"]