11

I'm on OS X using ZSH (have lots of homebrew stuff, too).

I'd like to know the PID of my current terminal.

(I'm learning more about process management on *nix systems, pstree and the like, and so this is more an academic question vs. a specific use case I'm trying to solve)

EDIT: to clarify, I'm referring to the process that is running my current terminal/commandline.

John Hinnegan
  • 222
  • 1
  • 2
  • 8

1 Answers1

19

The special variable $$ is the current pid of the shell you are running, for any Bourne compatible (and, so, POSIX) shell.

Daniel Pittman
  • 3,688
  • 17
  • 15