Bird
0
0

What will be the output of the following command sequence?

medium📝 Command Output Q13 of 15
Linux CLI - Process Management
What will be the output of the following command sequence?
sleep 100 &
kill -15 $!

Assuming $! is the PID of the sleep process.
AThe sleep process stops gracefully after receiving SIGTERM
BThe sleep process is immediately killed without cleanup
CThe sleep process ignores the signal and continues running
DSyntax error due to incorrect kill command
Step-by-Step Solution
Solution:
  1. Step 1: Understand the commands

    sleep 100 & runs sleep in background. $! stores its PID. kill -15 $! sends SIGTERM (signal 15) to that PID.
  2. Step 2: Effect of SIGTERM on sleep

    SIGTERM asks the process to stop gracefully. Sleep will stop waiting and exit cleanly.
  3. Final Answer:

    The sleep process stops gracefully after receiving SIGTERM -> Option A
  4. Quick Check:

    kill -15 sends SIGTERM = graceful stop [OK]
Quick Trick: Signal 15 (SIGTERM) politely stops processes [OK]
Common Mistakes:
  • Confusing SIGTERM with SIGKILL immediate stop
  • Assuming sleep ignores SIGTERM
  • Thinking kill command syntax is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes