Question
3. Control jobs for multi-tasking (a) Create some jobs i. Type cat command in the terminal, and press ctrl-c to terminate it. Type jobs command
3. Control jobs for multi-tasking (a) Create some jobs
i. Type cat command in the terminal, and press ctrl-c to terminate it. Type jobs command and you will see nothing.
ii. Type cat command in the terminal, and press ctrl-z to stop it (suspend it). Use jobs command and what do you see?
iii. Execute some command in the background using the &, for example: sleep 90 & iv. Execute another command (for example, man nano) and press ctrl-z to stop it. v. Use the jobs to see all jobs.
(b) Switch between jobs
i. Use the fg command to bring a stopped job to foreground. By default it is the one with the + sign (see jobs command output)
ii. Or we can specifically use fg [job-number] to bring any jobs to foreground. For example, fg 3. See the job number from the jobs command output.
iii. Use ctrl-z to stop a job and send it to background
iv. Practice switching between the nano job and the man nano job. (c) Kill the cat job (terminate it)
-
kill %1
-
Verify using the jobs command
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started