# How to get the parent process id, ppid?

**URL:** https://discourse.julialang.org/t/how-to-get-the-parent-process-id-ppid/116507
**Category:** General Usage
**Tags:** question
**Created:** [July 2, 2024, 7:41am UTC](https://discourse.julialang.org/t/how-to-get-the-parent-process-id-ppid/116507 "2024-07-02T07:41:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![schlichtanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/schlichtanders/32/32145_2.png) [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)
#### Post date: [July 2, 2024, 7:41am UTC](https://discourse.julialang.org/t/how-to-get-the-parent-process-id-ppid/116507/1 "2024-07-02T07:41:14Z")

</div>

I am trying to find out whether my julia is called from python, from R or plainly julia.

Research brought me to using the ppid on Unix based systems, however I couldn’t find how to get it using julia.

---

<div class="post-metadata">

### Author: ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)
#### Post date: [July 2, 2024, 7:47am UTC](https://discourse.julialang.org/t/how-to-get-the-parent-process-id-ppid/116507/2 "2024-07-02T07:47:28Z")

</div>

Try this:

```julia
getppid() = @ccall getppid()::Cint

```

Test:

```julia
julia> getppid()
1366207

```

---

<div class="post-metadata">

### Author: ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)
#### Post date: [July 2, 2024, 7:51am UTC](https://discourse.julialang.org/t/how-to-get-the-parent-process-id-ppid/116507/3 "2024-07-02T07:51:00Z")

</div>

Could perhaps be worth a PR given that we have

```julia
julia> Libc.getpid()
1371361

```
