CompTIA Linux+ (XK0-004) — Question 76
An administrator needs to kill the oldest Bash shell running in the system. Which of the following commands should be issued to accomplish this task?
Answer options
- A. ps axjf | grep bash to obtain PID kill -9 PID
- B. ps ג€"eo pid,etime,cmd | grep bash (to obtain PID) kill -9 PID
- C. ps ג€"eo pid,etime| grep bash (to obtain PID) killall -9 PID
- D. killall -15 -o bash
Correct answer: B
Explanation
Option B is correct because it lists the processes with their elapsed time, allowing the administrator to identify the oldest Bash shell by its running time before using kill -9 on its PID. Option A does not provide the elapsed time, making it harder to find the oldest process. Option C uses killall, which is not effective in this scenario since it would terminate all instances of Bash, not just the oldest one. Option D uses an incorrect signal option, as -o is not valid in the context of the killall command.