cross-port-killer
Kill the process running on a given TCP port on Windows, Linux and Mac
Last updated 4 years ago by milewski .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cross-port-killer 
SYNC missed versions from official npm registry.

cross-port-killer

npm version npm downloads dependencies

Kill the process running on a given TCP port on Windows, Linux and Mac

Install

$ npm install cross-port-killer -D

Usage

import { kill, killer } from 'cross-port-killer';

kill(9090).then(pids => {
  console.log(pids)
})

// you could also kill pids manually if you know them... this would save you bringing up another lib, you are welcome.

killer.killByPid(12345).then(() => console.log('done'))
killer.killByPids([12345, 54321]).then(() => console.log('done'))

This lib also comes with a CLI.

To kill any process occupying the port 9090 you can run:

$ npx cross-port-killer 9090

or

$ npm install cross-port-killer -g
$ kill-port 9090

Dependencies

On Linux/Mac this library depends on lsof in case you don't have it installed (perhaps you are using docker?) run:

$ apt-get install lsof

On Mac, It comes with the OS by default so nothing to worries.

License

MIT © Rafael Milewski

Current Tags

  • 1.4.0                                ...           latest (4 years ago)

8 Versions

  • 1.4.0                                ...           4 years ago
  • 1.3.0                                ...           5 years ago
  • 1.2.1                                ...           7 years ago
  • 1.1.1                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
  • 0.0.1                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (9)

Copyright 2013 - present © cnpmjs.org | Home |