# Finding Your Application Process ID (PID)
Before yCrash can capture diagnostic data from your application, it needs the Process ID (PID) of the running process. The PID uniquely identifies your application among all processes running on the system and is required as input when using yCrash for troubleshooting.
This page explains how to find the PID for each supported platform. Use the section that matches your application's runtime environment.
# Java Applications
Java applications run inside the Java Virtual Machine (JVM), and the JDK ships with dedicated tools that make identifying the PID straightforward. The methods below cover both Linux/macOS and Windows environments.
# Linux and macOS
1. Using jps (Recommended)
The jps -l (JVM Process Status) tool is bundled with the JDK and is the quickest way to list all Java processes running on a machine along with their PIDs.
jps -l
The output lists each Java process on a separate line, with the PID in the first column and the main class or JAR name in the second. The output will look similar to the following:
| PID | FULL_CLASS_NAME (or JAR_PATH) |
|---|---|
| 75377 | buggyApp.jar |
| 76637 | sun.tools.jps.Jps |
NOTE:
jps -lonly shows Java processes. If your application does not appear, verify it was started using the same JDK installation and that the jps binary is on your PATH.
2. Using ps
If jps is not available, the standard ps command provides an alternative. Run the following from any terminal:
ps -ef | grep java
This lists all processes whose command line contains the word java. Each line shows the user who launched the process, the PID (second column), and the full command with all arguments useful when multiple Java processes are running and you need to identify a specific one by its startup flags. The output will look similar to the following:
| UID | PID | PPID | C | STIME | TTY | TIME | CMD |
|---|---|---|---|---|---|---|---|
| ec2-user | 75377 | 75161 | 99 | 04:10 | pts/2 | 00:04:16 | java -jar buggyApp.jar PROBLEM_CPU (your Java application) |
| ec2-user | 75590 | 75447 | 0 | 04:13 | pts/3 | 00:00:00 | jgrep --color=auto java |
# Windows
1.Using jps (Recommended)
The jps tool works on Windows as well. Open a Command Prompt, navigate to the bin directory of your JDK installation, and run:
cd C:\Program Files\Java\jdk1.8.0_181\bin
jps
2
Adjust the path to match your JDK version and installation location. The output will list all running Java processes and their PIDs, for example:
| PID | Process |
|---|---|
| 1234 | Bootstrap (your Tomcat server) |
| 5678 | Jps (the jps command itself) |
NOTE: Unlike the
pscommand on Linux,jpsdisplays only the first segment of each process's command. To view the full list of startup arguments for a Java process on Windows, use the Task Manager or a tool such as Process Explorer.
# .NET Applications
.NET applications run on Windows under the Common Language Runtime (CLR). The following methods can be used to identify the PID of a running .NET process. In the examples below, replace paymentService.exe or paymentService with the actual name of your application's executable.
1. Using Command Prompt
Open a Command Prompt and run:
tasklist | findstr paymentService
This filters the full process list to show only lines matching your application's executable name. The output will look similar to the following:
| Image Name | PID | Session Name | Session# | Mem Usage |
|---|---|---|---|---|
| paymentService.exe | 4892 | Console | 1 | 24,576 k |
The second column (PID) contains the Process ID you need.
2. Using PowerShell
Open a PowerShell window and run the following command, replacing paymentService with your application's name:
Get-Process *paymentService*
PowerShell will display a table of process details. The Id column contains the Process ID. The output will look similar to the following:
| Handles | NPM(K) | PM(K) | WS(K) | CPU(s) | Id | SI | ProcessName |
|---|---|---|---|---|---|---|---|
| 225 | 14 | 188152 | 175692 | 0.19 | 29920 | 1 | paymentService |
NOTE:
The Get-Process command does not require the file extension. PowerShell matches processes by name, so
paymentServiceandpaymentService.exeare treated identically.Wrap the name in asterisks
*to perform a partial/wildcard match. Without them, PowerShell requires an exact name match and will return an error if the full process name doesn't match precisely.
3. Using Task Manager
Task Manager provides a graphical way to find the PID without using the command line:
- Press Ctrl + Shift + Esc to open Task Manager.
- Click the Details tab.
- Locate your application in the list (e.g.,
paymentService.exe). - The
PIDcolumn displays the Process ID.
TIP: If the PID column is not visible, right-click on any column header, select Select columns, and enable PID.
# Node.js Applications
Node.js applications run as node (or node.exe on Windows) processes. There is no Node equivalent of Java’s jps tool, so you find the PID with normal OS commands. When more than one Node process is running, pick the right one by looking at the entry script or startup arguments (for example server.js, app.js, or your app path).
NOTE: A machine can easily have several
nodeprocesses at once: your app, IDE helpers, build tools, PM2, and so on. Do not pick a PID just because the process name isnode. Match on a unique piece of the command line, such as your script name or app path.
# Linux and macOS
1. Using ps (Recommended)
ps shows Node processes along with the full command line, which makes it easier to spot your app when many node processes are present.
ps -ef | grep node
Each line shows the user who started the process, the PID (second column), and the full command. The output will look similar to the following:
| UID | PID | PPID | C | STIME | TTY | TIME | CMD |
|---|---|---|---|---|---|---|---|
| ec2-user | 18432 | 18410 | 5 | 10:22 | pts/1 | 00:01:12 | node server.js |
| ec2-user | 18501 | 18490 | 0 | 10:25 | pts/2 | 00:00:00 | grep --color=auto node |
Here, 18432 is the PID for the app started with server.js. You can ignore the grep line.
To focus on your app only, search for something unique from the startup command:
ps -ef | grep server.js
2. Using pgrep
pgrep lists matching PIDs. With -af it also prints the command line:
pgrep -af node
Or match your entry script:
pgrep -af 'server\.js'
Example output:
18432 node server.js
18610 node /usr/lib/node_modules/pm2/...
2
Use the PID that belongs to your application’s entry file.
NOTE: If you run the app under PM2,
pm2 listorpm2 pid <app-name>will also give you the PID. In cluster mode you will see a primary process plus workers. Capture the process you actually want to troubleshoot (often the primary, or the worker that is misbehaving).
# Windows
1. Using Command Prompt
Open a Command Prompt and run:
tasklist | findstr node
This filters the process list to lines that contain node. The output will look similar to the following:
| Image Name | PID | Session Name | Session# | Mem Usage |
|---|---|---|---|---|
| node.exe | 12456 | Console | 1 | 82,144 K |
The second column (PID) is the Process ID. If you see more than one node.exe, use PowerShell or Task Manager and check the command line so you pick the correct app.
2. Using PowerShell
Open a PowerShell window and run:
Get-Process *node*
PowerShell prints a table of process details. The Id column is the Process ID. The output will look similar to the following:
| Handles | NPM(K) | PM(K) | WS(K) | CPU(s) | Id | SI | ProcessName |
|---|---|---|---|---|---|---|---|
| 312 | 28 | 94520 | 110204 | 2.41 | 12456 | 1 | node |
Get-Process alone does not show which script was started. To see the command line:
Get-CimInstance Win32_Process -Filter "Name = 'node.exe'" |
Select-Object ProcessId, CommandLine
2
Example output:
| ProcessId | CommandLine |
|---|---|
| 12456 | "C:\Program Files\nodejs\node.exe" server.js |
| 13002 | "C:\Program Files\nodejs\node.exe" C:\tools\eslint\... |
Take the ProcessId from the row whose CommandLine matches your application.
NOTE:
Get-Processmatches on the process name (node/node.exe). When several Node processes are running, useGet-CimInstance(or Task Manager with the Command line column) to see the script path.- Put asterisks around the name for a partial match, for example
Get-Process *node*.
3. Using Task Manager
Task Manager is useful if you prefer not to use the command line:
- Press Ctrl + Shift + Esc to open Task Manager.
- Open the Details tab.
- Find
node.exein the list. - Read the value in the PID column.
TIP: If the PID column is missing, right-click any column header, choose Select columns, and turn on PID. If you have more than one
node.exe, also turn on Command line.