Open In App

Node.js process.pid Property

Last Updated : 12 Oct, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The process.pid property is an inbuilt application programming interface of the process module which is used to get the PID of the process.

Syntax:

process.pid

Return Value: This property returns an integer value specifying the PID of the process.

Below examples illustrate the use of process.pid property in Node.js:

Example:




// Node.js program to demonstrate the
// process.pid Property
   
// Include process module
const process = require('process');
  
// Printing process.pid property value
console.log("process id is " + process.pid);


Output:

process id is 11436

Note: The above program will compile and run by using the node filename.js command.

Reference: https://nodejs.org/api/process.html#process_process_pid


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads