nerdexam
CompTIA

LX0-103 · Question #127

Which of the following commands kills the process with the PID 123 but allows the process to "clean up" before exiting?

The correct answer is D. kill -TERM 123. SIGTERM is the standard signal for requesting graceful process termination, giving the process an opportunity to perform cleanup before exiting.

GNU and Unix Commands

Question

Which of the following commands kills the process with the PID 123 but allows the process to "clean up" before exiting?

Options

  • Akill -PIPE 123
  • Bkill -KILL 123
  • Ckill -STOP 123
  • Dkill -TERM 123

How the community answered

(46 responses)
  • A
    4% (2)
  • B
    2% (1)
  • D
    93% (43)

Why each option

SIGTERM is the standard signal for requesting graceful process termination, giving the process an opportunity to perform cleanup before exiting.

Akill -PIPE 123

SIGPIPE is sent when a process attempts to write to a broken pipe; it is not used to request process termination.

Bkill -KILL 123

SIGKILL (signal 9) immediately and unconditionally terminates the process - it cannot be caught, blocked, or ignored, so no cleanup is possible.

Ckill -STOP 123

SIGSTOP suspends (pauses) the process rather than terminating it; the process remains in memory and can be resumed with SIGCONT.

Dkill -TERM 123Correct

SIGTERM (signal 15) is the default termination signal and can be caught by the process, allowing it to run signal handlers that close files, release resources, or save state before exiting. This is distinct from forced termination because the process retains control over how it shuts down. kill -TERM 123 sends SIGTERM to PID 123, fulfilling the requirement for a clean shutdown.

Concept tested: Linux process signals and graceful termination

Source: https://man7.org/linux/man-pages/man7/signal.7.html

Topics

#kill command#SIGTERM#process signals#process management

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice