Linux+ XK0-004: How to Stop Multiple Processes Consuming Excessive Memory | CompTIA Linux+ Exam Prep

Stop Application Processes in Linux | CompTIA Linux+ Exam Guide

Question

A Linux system is running normally when the systems administrator receives an alert that one application spawned many processes.

The application is consuming a lot of memory, and it will soon cause the machine to become unresponsive.

Which of the following commands will stop each application process?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

B.

https://www.tecmint.com/how-to-kill-a-process-in-linux/

The correct command to stop each application process that is consuming a lot of memory and causing the machine to become unresponsive is option D - pkill -9 application.

Explanation:

A. kill pidof application: This command will attempt to stop the process with the process ID (PID) of the first instance of the application. However, if the application has spawned multiple processes, this command will only stop one of them. This will not solve the issue of the application consuming a lot of memory and causing the machine to become unresponsive.

B. killall application: This command will stop all processes with the given name, including ones that may be running other applications that happen to have the same name. This could lead to unintended consequences, such as stopping other applications that are unrelated to the issue at hand.

C. kill -9 ps "aux | grep application: This command has a syntax error as the ps command should not be in quotes. Additionally, the command is attempting to kill the ps command, which is not the application that is causing the issue. This command is unlikely to stop any of the processes associated with the application.

D. pkill -9 application: This command will stop all processes with the given name, including ones that may have been spawned by the application. The -9 option sends a SIGKILL signal to the processes, which forcefully terminates them. This will stop the application from consuming memory and causing the machine to become unresponsive.

Therefore, the correct command to stop each application process that is consuming a lot of memory and causing the machine to become unresponsive is option D - pkill -9 application.