title: How to get the current Linux process ID from the command line a in shell-agnostic, language-agnostic way
body: <p>How does one get their current process ID (pid) from the Linux command line in a shell-agnostic, language-agnostic way?</p>
  
  <p><a href="http://linux.die.net/man/8/pidof" rel="noreferrer"><code>pidof(8)</code></a> appears to have no option to get the calling process' <code>pid</code>.  Bash, of course, has <code>$$</code> - but for my generic usage, I can't rely on a shell (Bash or otherwise).  And in some cases, I can't write a script or compilable program, so Bash / Python / C / C++ (etc.) will not work.</p>
  
  <p>Here's a specific use case: I want to get the <code>pid</code> of the running, <a href="http://fabfile.org" rel="noreferrer">Python-Fabric</a>-based, remote SSH process (where one may want to avoid assuming bash is running), so that among other things I can copy and/or create files and/or directories with unique filenames (as in <code>mkdir /tmp/mydir.$$</code>).</p>
  
  <p>If we can solve the Fabric-specific problem, that's helpful - but it doesn't solve my long-term problem.  For general-purpose usage in all future scenarios, I just want a command that returns what <code>$$</code> delivers in Bash.</p>