— Get process id of current process
$ echo $$
6113
— shows process id
$ ps
PID TTY TIME CMD
2050 pts/2 00:00:00 ps
6113 pts/2 00:00:00 ksh
Useful when creating a unique temp file example TEMPFILE=/tmp/tmpfile.$$
— Get process id of last background id
$ sleep 10 &
[1] 2078
$ echo $!
2078
— Print parent process id
$ print $PPID
6048