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.
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
killcommand.
Requirements
- You need to perform the challenge in a Linux environment.
- Use the
pscommand to list the processes and identify the enemy ninja processes namedmysql. - Utilize the
killcommand to terminate the identified enemy ninja processes namedmysql - 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'
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
bashscripting language to create the shell script in~/project/terminate_mysql.sh. - The shell script should effectively terminate all enemy ninja processes named
mysqlusing thekillcommand.
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'
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.



