{"id":13483965,"url":"https://github.com/yibn2008/find-process","last_synced_at":"2025-05-16T12:12:09.945Z","repository":{"id":3602012,"uuid":"50232167","full_name":"yibn2008/find-process","owner":"yibn2008","description":"find process by port/pid/name etc.","archived":false,"fork":false,"pushed_at":"2025-01-09T13:38:14.000Z","size":308,"stargazers_count":133,"open_issues_count":3,"forks_count":46,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-13T03:35:19.862Z","etag":null,"topics":["cli","find-process","port","process"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yibn2008.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-01-23T09:30:19.000Z","updated_at":"2025-04-28T15:32:10.000Z","dependencies_parsed_at":"2024-01-13T18:24:29.657Z","dependency_job_id":"acb84422-519e-4616-98c9-c97359218b05","html_url":"https://github.com/yibn2008/find-process","commit_stats":{"total_commits":103,"total_committers":13,"mean_commits":7.923076923076923,"dds":0.5145631067961165,"last_synced_commit":"ca159eca6607a34349dba55812252ca4c5604cb7"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yibn2008%2Ffind-process","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yibn2008%2Ffind-process/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yibn2008%2Ffind-process/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yibn2008%2Ffind-process/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yibn2008","download_url":"https://codeload.github.com/yibn2008/find-process/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254527099,"owners_count":22085919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","find-process","port","process"],"created_at":"2024-07-31T17:01:17.360Z","updated_at":"2025-05-16T12:12:09.918Z","avatar_url":"https://github.com/yibn2008.png","language":"JavaScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# find-process\n\n[![Node.js CI](https://github.com/yibn2008/find-process/actions/workflows/nodejs.yml/badge.svg)](https://github.com/yibn2008/find-process/actions/workflows/nodejs.yml)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n\nWith find-process, you can:\n\n- find the process which is listening specified port\n- find the process by pid\n- find the process by given name or name pattern\n\nWe have covered the difference of main OS platform, including **Mac OSX**, **Linux**, **Windows**\nand **Android** (with [Termux](https://termux.com)).\n\n## CLI\n\nInstall find-process as a CLI tool:\n\n```sh\n$ npm install find-process -g\n```\n\nUsage:\n\n```sh\n\n  Usage: find-process [options] \u003ckeyword\u003e\n\n\n  Options:\n\n    -V, --version      output the version number\n    -t, --type \u003ctype\u003e  find process by keyword type (pid|port|name)\n    -p, --port         find process by port\n    -h, --help         output usage information\n\n  Examples:\n\n    $ find-process node          # find by name \"node\"\n    $ find-process 111           # find by pid \"111\"\n    $ find-process -p 80         # find by port \"80\"\n    $ find-process -t port 80    # find by port \"80\"\n\n```\n\nExample:\n\n![image](https://user-images.githubusercontent.com/4136679/62670202-f49a6b00-b9c4-11e9-8692-7003c6c31a8a.png)\n\n## Node API\n\nYou can use npm to install:\n\n```sh\n$ npm install find-process --save\n```\n\nUsage:\n\n```javascript\nconst find = require('find-process');\n\nfind('pid', 12345)\n  .then(function (list) {\n    console.log(list);\n  }, function (err) {\n    console.log(err.stack || err);\n  })\n```\n\n## Synopsis\n\n```\nPromise\u003cArray\u003e find(type, value, [options])\n```\n\n**Arguments**\n\n- `type` the type of find, support: *port|pid|name*\n- `value` the value of type, can be RegExp if type is *name*\n- `options` this can either be the *object* described below or *boolean* to just set strict mode\n  - `options.strict` the optional strict mode is for checking *port*, *pid*, or *name* exactly matches the given one. (on Windows, `.exe` can be omitted)\n  - `options.logLevel` set the logging level to [`trace|debug|info|warn|error`](https://github.com/pimterry/loglevel#documentation). In practice this lets you silence a netstat warning on Linux.\n\n**Return**\n\nThe return value of find-process is Promise, if you use **co** you can use `yield find(type, value)` directly.\n\nThe resolved value of promise is an array list of process (`[]` means it may be missing on some platforms):\n\n```\n[{\n  pid: \u003cprocess id\u003e,\n  ppid: [parent process id],\n  uid: [user id (for *nix)],\n  gid: [user group id (for *nix)],\n  name: \u003ccommand/process name\u003e,\n  bin: \u003cexecute path (for *nix)\u003e,\n  cmd: \u003cfull command with args\u003e\n}, ...]\n```\n\n## Example\n\nFind process which is listening port 80.\n\n```javascript\nconst find = require('find-process');\n\nfind('port', 80)\n  .then(function (list) {\n    if (!list.length) {\n      console.log('port 80 is free now');\n    } else {\n      console.log('%s is listening port 80', list[0].name);\n    }\n  })\n```\n\nFind process by pid.\n\n```javascript\nconst find = require('find-process');\n\nfind('pid', 12345)\n  .then(function (list) {\n    console.log(list);\n  }, function (err) {\n    console.log(err.stack || err);\n  });\n```\n\nFind all nginx process.\n\n```javascript\nconst find = require('find-process');\n\nfind('name', 'nginx', true)\n  .then(function (list) {\n    console.log('there are %s nginx process(es)', list.length);\n  });\n```\n\nFind all nginx processes on Linux without logging a warning when run as a user who isn't root.\n\n```javascript\nconst find = require('find-process');\n\nfind('name', 'nginx', {strict: true, logLevel: 'error'})\n  .then(function (list) {\n    console.log('there are %s nginx process(es)', list.length);\n  });\n```\n## Contributing\n\nWe're welcome to receive Pull Request of bugfix or new feature, but please check the list before sending PR:\n\n- **Coding Style** Please follow the [Standard Style](https://github.com/feross/standard)\n- **Documentation** Add documentation for every API change\n- **Unit test** Please add unit test for bugfix or new feature\n\n## License\n\n[MIT](LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyibn2008%2Ffind-process","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyibn2008%2Ffind-process","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyibn2008%2Ffind-process/lists"}