While writing a Bourne-compatible startup script you need to make sure that the PID saved in /var/run/legacy.pid still belongs to a running process and that the current user has permission to signal it. The check must not disturb the daemon in any way; you only care about the command's exit status (0 means the process is present and signalable, non-zero means it is not). Which one of the following single-line commands meets this requirement by using the standard kill utility?
Passing signal 0 to the kill command is a POSIX-defined special case. No actual signal is delivered, but the normal existence and permission checks are still performed. Consequently, kill -0 <PID> returns an exit status of 0 if the target process exists and the current user has permission to send it a signal. It returns a non-zero exit status otherwise.
-HUP (signal 1) and -9 (SIGKILL) both transmit real signals that would affect the daemon. The -l option simply lists signal names and does not check a PID. Therefore, using signal 0 is the only option provided that accomplishes the required, non-intrusive check.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the command `kill -0` do specifically?
Open an interactive chat with Bash
Why is `kill -HUP` or `kill -9` not appropriate in this scenario?
Open an interactive chat with Bash
What kind of scenarios would require a non-intrusive check using `kill -0`?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .