
Product
Socket for Asana Is Now Available
Create and manage Asana tasks directly from Socket alerts, with manual task creation, automated ticketing rules, and two-way sync.
find-process
Advanced tools
With find-process, you can:
We have covered the difference of main OS platform, including macOS, Linux, Windows and Android (with Termux).
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
-v, --verbose print execute command
-d, --debug print debug info for issue reporting
-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:

You can use npm to install:
$ npm install find-process --save
import find, { ProcessInfo, FindConfig } from "find-process";
// Find process by PID
find('pid', 12345)
.then((list: ProcessInfo[]) => {
console.log(list);
})
.catch((err: Error) => {
console.log(err.stack || err);
});
// With configuration options
const config: FindConfig = {
strict: true,
logLevel: 'warn'
};
find('name', 'nginx', config)
.then((list: ProcessInfo[]) => {
console.log(`Found ${list.length} nginx processes`);
});
const find = require('find-process');
find('pid', 12345)
.then(function (list) {
console.log(list);
}, function (err) {
console.log(err.stack || err);
})
function find(type: 'port' | 'pid' | 'name', value: string | number, options?: FindConfig | boolean): Promise<ProcessInfo[]>
type - The type of search, supports: 'port' | 'pid' | 'name'value - The value to search for. Can be RegExp if type is 'name'options - Optional configuration object or boolean for strict mode
options.strict - Optional strict mode for exact matching of name (on Windows, .exe can be omitted)options.logLevel - Set logging level to 'trace' | 'debug' | 'info' | 'warn' | 'error'. Useful for silencing netstat warnings on Linuxoptions.skipSelf - Skip the current process when searching by nameoptions.verbose - Print the internal shell command to stdout before executingoptions.debug - Write each command, its stdout, and its stderr to stderr (implies verbose)Returns a Promise that resolves to an array of process information ([] means no processes found):
interface ProcessInfo {
pid: number; // Process ID
ppid: number; // Parent process ID
uid?: number; // User ID (Unix systems)
gid?: number; // Group ID (Unix systems)
name: string; // Command/process name
bin?: string; // Executable path (Unix systems)
cmd: string; // Full command with arguments
}
The package includes complete TypeScript definitions:
import { ProcessInfo, FindConfig, FindMethod } from 'find-process';
import find from 'find-process';
find('port', 80)
.then((list) => {
if (!list.length) {
console.log('Port 80 is free now');
} else {
console.log(`${list[0].name} is listening on port 80`);
}
});
import find from 'find-process';
find('pid', 12345)
.then((list) => {
console.log(list);
})
.catch((err) => {
console.log(err.stack || err);
});
import find from 'find-process';
find('name', 'nginx', true)
.then((list) => {
console.log(`There are ${list.length} nginx process(es)`);
});
import find from 'find-process';
find('name', 'nginx', { strict: true, logLevel: 'error' })
.then((list) => {
console.log(`Found ${list.length} nginx process(es)`);
});
import find from 'find-process';
async function findNodeProcesses() {
try {
const processes = await find('name', 'node');
console.log(`Found ${processes.length} Node.js processes`);
processes.forEach(proc => {
console.log(`PID: ${proc.pid}, Name: ${proc.name}, CMD: ${proc.cmd}`);
});
} catch (error) {
console.error('Error finding processes:', error);
}
}
# Clone the repository
git clone https://github.com/yibn2008/find-process.git
cd find-process
# Install dependencies
pnpm install
# Build the project
pnpm run build
# Run tests
pnpm test
# Run linting
pnpm run lint
pnpm run build - Compile TypeScript to JavaScriptpnpm run dev - Watch mode for developmentpnpm test - Run testspnpm run lint - Run linting and fix issuespnpm run type-check - TypeScript type checkingpnpm run check-version - Verify version consistencypnpm run update-history - Update HISTORY.md with recent commitsIf find-process returns unexpected results (e.g. a process is not found, or the wrong PID is returned), please attach the output of the --debug flag when opening a GitHub issue. This dumps the exact shell commands that were run and their raw output, which is almost always enough to diagnose the problem.
Run the same command that failed, but add the -d / --debug flag:
# Example: process not found on port 3000
find-process --debug -p 3000
# Example: process name search returns nothing
find-process --debug node
The output will look like this (debug lines go to stderr, results to stdout):
[debug] Platform : darwin
[debug] Node : v20.15.0
[debug] Version : 2.0.0
[debug] Command: netstat -anv -p TCP && netstat -anv -p UDP
[debug] stdout:
Active Internet connections (including servers)
...
[debug] stderr:
(empty)
[debug] Command: ps -p 1234 -ww -o pid,ppid,uid,gid,args
[debug] stdout:
PID PPID ...
[debug] stderr:
(empty)
[debug] Please copy the above output and attach it to your issue:
[debug] https://github.com/yibn2008/find-process/issues
============================================================
No process found
To capture the debug output, redirect stderr:
find-process --debug -p 3000 2>debug.txt
Paste the contents into the "Debug output" section of the bug report template.
Note: the debug output may contain process names and listening ports from your machine. Review it before sharing if you are working in a sensitive environment.
We welcome Pull Requests for bug fixes and new features. Please check the following before submitting a PR:
pnpm run build completes successfullyps-node is a package similar to find-process that allows for searching, looking up, and killing processes. It provides a broader API for process management compared to find-process, including the ability to kill processes.
pidusage is another package that provides information about running processes, such as CPU and memory usage statistics. While it focuses more on performance metrics rather than just finding processes, it serves a complementary role to find-process.
FAQs
find process info by port/pid/name etc.
The npm package find-process receives a total of 3,316,977 weekly downloads. As such, find-process popularity was classified as popular.
We found that find-process demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Product
Create and manage Asana tasks directly from Socket alerts, with manual task creation, automated ticketing rules, and two-way sync.

Security News
Open VSX has removed three extension IDs from its malicious-extension list as the legitimate publishers they impersonated move to claim the names for themselves.

Product
Socket’s PHP and Composer support is now in Beta for all customers, with PHP reachability analysis generally available.