13,420
edits
Changes
→INVESTIGATION 2: MANAGING PROCESSES
# Issue the '''jobs''' command. What do you notice?<br><br>
# Issue the following Linux commands:<br><span style="color:blue;font-family:courier;font-weight:bold">kill %2</span><br><span style="color:blue;font-family:courier;font-weight:bold">kill %3</span><br><br>
# Issue the '''jobs''' command (you may have to issue the ''jobs'' command several times to get final result).<br> What do you notice?<br><br>You can also manipulate processes by their '''PID''' ('''process ID''').<br><br>
# Let's use '''grouping''' to run several commands in sequence within a single process.<br><br>
# Issue the following Linux command: <span style="color:blue;font-family:courier;font-weight:bold">(sleep 400; sleep 500; sleep 600) &</span><br><br>
# Issue the '''jobs''' command. What do you notice?<br>You should notice all commands are run in a group as just one process.<br><br>
# Issue the following Linux command to terminate the first job running in the '''background''':<br><span style="color:blue;font-family:courier;font-weight:bold">kill %1</span><br><br>NOTE: If issuing the kill command does not work, then you would need to send a STRONGER signal<br>to "'''kill'''" (not "''SIGTERM'' - which is signal ''#15''") the process. The '''SIGKILL''' signal (signal '''#9''')<br>would be required to do this by issuing the '''kill''' command with the option: '''-9'''.<br><br>
# Issue the '''jobs''' command and make certain there are no processes that are running in the '''background'''.<br><br>You can also manipulate processes by their '''PID''' ('''process ID''').<br><br>Let's terminate our Matrix Bash shell process by using the '''kill''' command using that process' '''PID'''.<br><br>
# Issue the following Linux command: <span style="color:blue;font-family:courier;font-weight:bold">ps</span><br><br>
#Note in the '''ps''' command output the PID of the process called '''bash'''.<br><br>You will be using that PID when issuing the <u>next</u> Linux command.<br><br>