find process info by port/pid/name etc.
Last updated 9 months ago by bunchtogether .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @bunchtogether/find-process 
SYNC missed versions from official npm registry.

find-process Build Status js-standard-style

With find-process, you can:

  • find the process which is listening specified port
  • find the process by pid
  • find the process by given name or name pattern

We have covered the difference of main OS platform, including Mac OSX, Linux, Windows and Android (with Termux).


Install find-process as a CLI tool:

$ npm install find-process -g


  Usage: find-process [options] <keyword>


    -V, --version      output the version number
    -t, --type <type>  find process by keyword type (pid|port|name)
    -p, --port         find process by port
    -h, --help         output usage information


    $ find-process node          # find by name "node"
    $ find-process 111           # find by pid "111"
    $ find-process -p 80         # find by port "80"
    $ find-process -t port 80    # find by port "80"



Node API

You can use npm to install:

$ npm install find-process --save


const find = require('find-process');

find('pid', 12345)
  .then(function (list) {
  }, function (err) {
    console.log(err.stack || err);


Promise<Array> find(type, value, [strict])


  • type the type of find, support: port|pid|name
  • value the value of type, can be RegExp if type is name
  • strict the optional strict mode is for checking port, pid, or name exactly matches the given one. (on Windows, .exe can be omitted)


The return value of find-process is Promise, if you use co you can use yield find(type, value) directly.

The resolved value of promise is an array list of process ([] means it may be missing on some platforms):

  pid: <process id>,
  ppid: [parent process id],
  uid: [user id (for *nix)],
  gid: [user group id (for *nix)],
  name: <command/process name>,
  bin: <execute path (for *nix)>,
  cmd: <full command with args>
}, ...]


Find process which is listening port 80.

const find = require('find-process');

find('port', 80)
  .then(function (list) {
    if (!list.length) {
      console.log('port 80 is free now');
    } else {
      console.log('%s is listening port 80', list[0].name);

Find process by pid.

const find = require('find-process');

find('pid', 12345)
  .then(function (list) {
  }, function (err) {
    console.log(err.stack || err);

Find all nginx process.

const find = require('find-process');

find('name', 'nginx', true)
  .then(function (list) {
    console.log('there are %s nginx process(es)', list.length);


We're welcome to receive Pull Request of bugfix or new feature, but please check the list before sending PR:

  • Coding Style Please follow the Standard Style
  • Documentation Add documentation for every API change
  • Unit test Please add unit test for bugfix or new feature



Current Tags

  • 1.4.4                                ...           latest (9 months ago)

2 Versions

  • 1.4.4                                ...           9 months ago
  • 1.4.2                                ...           9 months ago
Maintainers (1)
Today 0
This Week 2
This Month 2
Last Day 0
Last Week 1
Last Month 5
Dependencies (3)
Dev Dependencies (3)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |