Open main menu

CDOT Wiki β

Changes

Tutorial8: Links / Process Management

115 bytes added, 12:38, 25 February 2021
INVESTIGATION 2: MANAGING PROCESSES
# 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:<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''') would be required to do this<br>by issuing the '''kill''' command with the option: '''-9'''. By the way, the '''ctrl-c''' key combination sends the ''SIGINT''<br>(signal interupt - which is signal ''#2'') to terminate processes running in the ''foreground''.<br><br>
# Issue the '''jobs''' command and make certain there are no processes that are running in the background.<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>
You will be using that PID when issuing the <u>next</u> Linux command.<br><br># Issue the following Linux command (using the bash process' PID number instead of "PID"):<br><span style="color:blue;font-family:courier;font-weight:bold">kill PID</span><br><br>What did you notice? It did not work since you need to send a STRONGER signal (eg. SIGKILL, not SIGTERM).<br><br>
# Issue the following Linux command (using the bash process' PID number instead of "PID"):<br><span style="color:blue;font-family:courier;font-weight:bold">kill -9 PID</span><br><br>What did you notice? You have been logged off your Matrix session!<br><br>
# Issue the '''jobs''' command and make certain there are no processes that are running in the background.<br><br>
# Issue the following Linux command: <span style="color:blue;font-family:courier;font-weight:bold">ps</span><br><br>What is the PID of the previously issued Linux command in the background?<br><br>
# Issue the following Linux command (using the PID number instead of "PID"):<br><span style="color:blue;font-family:courier;font-weight:bold">kill PID</span><br><br>
# Issue the '''jobs''' command. Is the sleep process still running?<br><br>'''NOTE:''' You need to issue the ''kill -9 PID'' command if the previous commands did not work.<br><br>
# Issue the following Linux command (using the PID number instead of "PID"):<br><span style="color:blue;font-family:courier;font-weight:bold">kill -9 PID</span><br><br>
# Issue the '''jobs''' and '''ps''' commands to confirm there are no processes running in the background.<br><br>
:In the next investigation, you will learn how to create aliases and view command history on your Matrix server.<br><br>
13,420
edits