# 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 in the output 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
On Windows, npm run … (and similar wrappers) often starts two node.exe processes: one for the npm CLI, and one for your application. tasklist only shows the image name, so both look identical. Prefer a command that shows the command line, then pick the PID whose command matches your app entry file (for example server.js or src\server.js), not npm-cli.js.
1. Using PowerShell (Recommended)
Open a PowerShell window and run:
Get-CimInstance Win32_Process -Filter "Name = 'node.exe'" | Select-Object ProcessId, CommandLine
This lists each Node process with the command that started it. Pick the ProcessId from the row that matches your app.
Example output:
| ProcessId | CommandLine |
|---|---|
| 536 | "C:\Program Files\nodejs\node.exe" C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js run web |
| 31876 | "C:\Program Files\nodejs\node.exe" src\server.js |
In this example, 31876 is the PID to pass to yc-360 (src\server.js). 536 is the npm wrapper and should not be used for capture.
2. Using Command Prompt (WMIC)
If PowerShell is unavailable, Command Prompt can show the same information with WMIC:
wmic process where "name='node.exe'" get ProcessId,CommandLine
The output will look similar to:
CommandLine ProcessId
node C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js run web 536
node C:\myapp\src\server.js 31876
2
3
NOTE: WMIC is deprecated and may be missing on newer Windows installations. Prefer the PowerShell
Get-CimInstancecommand above when it is available.
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 so you can tell the npm wrapper from your application.
4. Using tasklist (limited)
tasklist | findstr node
This filters the process list to lines that contain node. The second column is the PID, but the output does not show the command line:
| Image Name | PID | Session Name | Session# | Mem Usage |
|---|---|---|---|---|
| node.exe | 536 | Console | 1 | 66,280 K |
| node.exe | 31876 | Console | 1 | 57,256 K |
Use this only when a single node.exe is running. If you see more than one, switch to PowerShell, WMIC, or Task Manager with the Command line column enabled.