Multiple choice technology operating systems

Command to kill the last background job?

  1. kill $!
  2. kill -9

  3. kill bg

  4. kill $*
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In Unix shell scripting, '$!' is a special variable that holds the process ID (PID) of the last background job. 'kill $!' sends a termination signal to that process. Option B is incomplete (kill -9 needs a PID). Option C uses 'bg' which is not a variable for job reference. Option D uses '$*' which represents all positional parameters, not a background job. The $! variable is specifically designed to reference the most recent background job's PID.