Multiple choice technology operating systems

How to find out pid of current shell?

  1. ps

  2. echo $$
  3. ptree

  4. psrinfo

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The command 'echo $$' displays the PID of the current shell, as $$ is a special shell variable that expands to the shell's own process ID. 'ps' without arguments shows processes for the current terminal but not specifically the shell's PID, 'ptree' shows process trees, and 'psrinfo' shows processor information. The $$ variable is the standard way to access the current shell's PID.