Sys.getpid Function in R (Example)


In this tutorial, I’ll show how to get the process ID of an R session using the Sys.getpid function in the R programming language.

Table of contents:

Let’s get started!


Example: Get Process ID of Current R Session Using Sys.getpid() Function

In this example, I’ll demonstrate how to return the process identifier (or process ID; PID) of the currently running R programming session.

For this task, we can apply the Sys.getpid function as shown in the following code:

Sys.getpid()                     # Applying Sys.getpid
# [1] 56

As you can see, the previous R syntax has returned the process ID, i.e. the number 56.


Video & Further Resources

Have a look at the following video instruction on my YouTube channel. In the video, I illustrate the R programming code of this tutorial:


The YouTube video will be added soon.


In addition, you might read some of the related RStudio tutorials on You can find a selection of tutorials below:


Summary: In this R post you have learned how to apply the Sys.getpid function. If you have further questions, please let me know in the comments below. In addition, don’t forget to subscribe to my email newsletter for regular updates on the newest tutorials.


Subscribe to the Statistics Globe Newsletter

Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.