# 9.1 Killing Processes This will teach you how to detect, show and eliminate processes. ### Processes Open **two** terminal windows to your VM, side by side, to be referred to as left and right. In the **left** window, start three processes that append text to an output file at one-second intervals. To properly background each process, the complete command set must be contained in parentheses and end with an ampersand. ```bash [greater@rhcsa ~]$ while true; do echo -n "game" >> ~/outfile; sleep 1; done & ``` You will get a message that looks like this ```[1] 14969```. Execute the following commands too: ```bash while true; do echo -n "set" >> ~/outfile; sleep 1; done & while true; do echo -n "match" >> ~/outfile; sleep 1; done & ``` In the **right** window, use tail to confirm that all three processes are appending to the file: ```bash [greater@rhcsa ~]$ tail -f ~/outfile ``` In the **left** window, view jobs to see all three processes "Running": ```bash [greater@rhcsa ~]$ jobs [1] Running while true; do echo -n "game" >> ~/outfile; sleep 1; done & [2]- Running while true; do echo -n "set" >> ~/outfile; sleep 1; done & [3]+ Running while true; do echo -n "match" >> ~/outfile; sleep 1; done & ``` Suspend the "game" process using signals. ```bash [greater@rhcsa ~]$ kill -SIGSTOP %number ``` Confirm that the "game" process is "Stopped". ```bash [greater@rhcsa ~]$ jobs ``` In the **right** window, confirm that "game" output is no longer active.. Terminate the "set" process using signals. Confirm that the "set" process has disappeared. In the right window, confirm that "set" output is no longer active: ```bash [greater@rhcsa ~]$ kill –SIGTERM %number ``` ```bash [greater@rhcsa ~]$ jobs ``` Resume the "game" process using signals: ```bash [greater@rhcsa ~]$ kill –SIGCONT %number ``` Confirm that the "game" process is "Running": ```bash [greater@rhcsa ~]$ jobs ``` Terminate the remaining two jobs: ```bash [greater@rhcsa ~]$ kill –SIGTERM %number ``` Confirm that no jobs remain and that output has stopped: ```bash [greater@rhcsa ~]$ jobs ``` From the **left** window, terminate the right window's tail command: ```bash [greater@rhcsa ~]$ pkill –SIGTERM tail ```