Difficulty: Easy
Correct Answer: kill
Explanation:
Introduction / Context:
When a program hangs or must be stopped, Unix/Linux provides a signal mechanism to request termination. The standard user-space tool to send signals to processes—whether gentle or forceful—is fundamental for administration and scripting.
Given Data / Assumptions:
Concept / Approach:
Use 'kill PID' to send SIGTERM (15) by default, allowing the process to exit gracefully. If it does not respond, 'kill -9 PID' sends SIGKILL, which the process cannot catch or ignore. Other signals like SIGHUP can request reloads. The 'kill' command is versatile and supports multiple PIDs and process group signaling.
Step-by-Step Solution:
Verification / Alternative check:
Check logs or process status post-signal. For services managed by init/systemd, use service-aware tools (for example, 'systemctl stop') which may call 'kill' under the hood.
Why Other Options Are Wrong:
Common Pitfalls:
Overusing '-9' which bypasses cleanup, signaling the wrong PID, or failing to consider service managers that auto-respawn processes.
Final Answer:
kill
Discussion & Comments