Ninja Process Termination Training

LinuxLinuxBeginner
Practice Now

Introduction

In a remote ancient Japanese ninja village, you are a young apprentice learning the ways of the ancient ninja arts. Your village is under threat from an enemy ninja clan, and as a crucial training exercise, you must learn to use the kill command in Linux to terminate enemy ninja processes that pose a threat to your village. Your ultimate goal is to ensure the safety and security of your village by terminating specific enemy ninja processes using the kill command.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("Linux")) -.-> linux/ProcessManagementandControlGroup(["Process Management and Control"]) linux/ProcessManagementandControlGroup -.-> linux/kill("Process Terminating") subgraph Lab Skills linux/kill -.-> lab-271314{{"Ninja Process Termination Training"}} end

Terminating Enemy Ninjas

Tasks

  • You are required to identify the processes of the enemy ninja clan that pose a threat to your village.
  • Terminate the identified enemy ninja processes using the kill command.

Requirements

  • You need to perform the challenge in a Linux environment.
  • Use the ps command to list the processes and identify the enemy ninja processes named mysql.
  • Utilize the kill command to terminate the identified enemy ninja processes named mysql
  • Operate within the default working directory /home/labex/project.

Example

Upon successful completion, the output of the ps command should reveal termination of the enemy ninja processes named mysql.

labex:project/ $ ps -aux | grep 'mysql'
โœจ Check Solution and Practice

Advanced Termination Techniques

Tasks

  • Implement a shell script to automatically terminate all enemy ninja processes.
  • Ensure that the shell script terminates the enemy ninja processes without leaving any residues.

Requirements

  • Use the bash scripting language to create the shell script in ~/project/terminate_mysql.sh.
  • The shell script should effectively terminate all enemy ninja processes named mysql using the kill command.

Example

Upon successful execution of the shell script, all processes associated with the enemy ninja clan should be terminated without any remaining traces.

Make sure to test the shell script to verify its functionality.

sudo chmod +x terminate_mysql.sh
./terminate_mysql.sh

Check if the enemy ninja processes have been successfully terminated:

$ ps -aux | grep 'mysql'
โœจ Check Solution and Practice

Summary

In this challenge, you will learn how to effectively utilize the kill command in Linux to terminate specific processes, simulating the crucial task of defending your ancient ninja village. This exercise will provide you with practical experience in process termination and enhance your understanding of managing processes in a Linux environment.