All Projects → yibn2008 → Find Process

yibn2008 / Find Process

Licence: mit
find process by port/pid/name etc.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Find Process

Kill Port
❌ Kill the process running on given port
Stars: ✭ 143 (+78.75%)
Mutual labels:  port, process
Sympact
🔥 Stupid Simple CPU/MEM "Profiler" for your JS code.
Stars: ✭ 439 (+448.75%)
Mutual labels:  cli, process
Procs
A modern replacement for ps written in Rust
Stars: ✭ 2,435 (+2943.75%)
Mutual labels:  cli, process
Fkill Cli
Fabulously kill processes. Cross-platform.
Stars: ✭ 6,418 (+7922.5%)
Mutual labels:  cli, process
Multiprocess
🚀Easy to make the common PHP/Python/js...script change daemon and multi-process execution
Stars: ✭ 151 (+88.75%)
Mutual labels:  cli, process
Cliwrap
Library for running command line processes
Stars: ✭ 1,057 (+1221.25%)
Mutual labels:  cli, process
Emus
Start the Android Emulator and the iOS Simulator from the command line
Stars: ✭ 78 (-2.5%)
Mutual labels:  cli
Tsv Utils
eBay's TSV Utilities: Command line tools for large, tabular data files. Filtering, statistics, sampling, joins and more.
Stars: ✭ 1,215 (+1418.75%)
Mutual labels:  cli
Json2go
Create go type representation from json
Stars: ✭ 76 (-5%)
Mutual labels:  cli
Tools
Game development tools for the Amethyst engine
Stars: ✭ 76 (-5%)
Mutual labels:  cli
Mpb
multi progress bar for Go cli applications
Stars: ✭ 1,221 (+1426.25%)
Mutual labels:  cli
Spam Bot 3000
Social media research and promotion, semi-autonomous CLI bot
Stars: ✭ 79 (-1.25%)
Mutual labels:  cli
Cra Generate
Scaffold a React component.
Stars: ✭ 78 (-2.5%)
Mutual labels:  cli
Pilgo
Configuration-based dotfiles manager
Stars: ✭ 78 (-2.5%)
Mutual labels:  cli
Mvn Search
command-line interface for the haters of the search.maven.org UI
Stars: ✭ 79 (-1.25%)
Mutual labels:  cli
Sparrow
Sparrow - script distribution platform for Linux OS
Stars: ✭ 77 (-3.75%)
Mutual labels:  cli
Nord Terminator
An arctic, north-bluish clean and elegant Terminator color theme.
Stars: ✭ 78 (-2.5%)
Mutual labels:  cli
Batchit
simple jobs submission via command-line for AWS batch
Stars: ✭ 77 (-3.75%)
Mutual labels:  cli
Ppx deriving cmdliner
Ppx_deriving plugin for generating command line interfaces from types (Cmdliner.Term.t)
Stars: ✭ 78 (-2.5%)
Mutual labels:  cli
Google Music Scripts
A CLI utility for interacting with Google Music. https://google-music-scripts.readthedocs.io/
Stars: ✭ 79 (-1.25%)
Mutual labels:  cli

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).

CLI

Install find-process as a CLI tool:

$ npm install find-process -g

Usage:

  Usage: find-process [options] <keyword>


  Options:

    -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

  Examples:

    $ 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"

Example:

image

Node API

You can use npm to install:

$ npm install find-process --save

Usage:

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

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

Synopsis

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

Arguments

  • 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)

Return

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>
}, ...]

Example

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) {
    console.log(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);
  });

Contributing

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

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].