Study Guide Processes & Job Control Q1 - PID What does PID stand for? Q2 - Shell PID What shell command would I issue to display the PID of the shell I'm using? Q3 - Process vs. executable file Explain, in your own words, what is the difference between a process and an executable file Q4 - Definitions What does each of the following terms stand for? STDIN stands for [stdin] STDOUT stands for [stdout] STDERR stands for [stderr] Q5 - Background PID What shell command would you issue to display the PID of the last command you moved to the background?
Q6 - List of jobs What shell command would you issue to display the list of jobs in the background of your current shell session? Q7 - Processes list What shell command would you issue to display the list of processes on your machine? Q8 - Notify What shell command would you issue to configure a bash shell to notify immediately when background jobs finish? Q9 - Stop notify What shell command would you issue to configure a bash shell to stop notifying immediately when background jobs finish? Q10 - Pausing What shell commands would you issue to display the message wake up! after a pause of 21 seconds? Do not run your solution in the background, type it on a single line. Q11 - Background STDIN redirects What is the STDIN of a background process redirected to? Q12 - Definition foreground process Explain, in your own words, what a foreground process is. Q13 - Definition background process Explain, in your own words, what a background process is.
Q14 - Background processes Describe, in your own words, how a process might end up in the background? Q15 - Bg Describe, in your own words, what the bg shell command does and give an example of when it would be used. Q16 - Bg examples Describe, in your own words, an example of when the bg shell command would be used. Q17 - Fg Describe, in your own words, what the fg shell command does and give an example of when it would be used. Q18 - Fg examples Describe, in your own words, what the fg shell command does and give an example of when it would be used. Q19 - Job vs. Process Explain, in your own words, the difference between a job and a process. Q20 - Background files redirects Why is it recommended to redirect the STDOUT and STDERR of a background process to a file? Q21 - Process vs. Job IDs Explain, in your own words, why when starting a program such as a text editor, its process ID is different than its job ID.
Q22 - Job states What are the three states any job might be in at any given time? Q23 - Foreground to background Describe, in your own words, how you would make a job running in the foreground transition to the state running in the background. Q24 - Background to foreground Describe, in your own words, how you would make a job running in the background transition to the state running in the foreground. Q25 - Notify options Explain, in your own words, what is the difference in the behavior of the Bash shell when we have the notify option turned on vs. turned off. Q26 - Korn shell We are working in a Bash shell session right now. I need to try something out in a Korn shell. I therefore issue the ksh command. The process running in the foreground of my Bash shell is now a Korn shell! Which of the shell will be suspended if I issue the suspend shell command. Q27 - Ksh to bash I ve been introducing a friend of mine to Bash. He was used to ksh so we started a bash shell from within his ksh and kept suspending it when we needed to go back to ksh for a minute for him to show me how he would tackle a given task with his old shell. I noticed that every time we suspend the bash shell, he entered suspend f. I told him this wasn t necessary. Explain why. Q28 - Shell vs. login shell Explain, in your own words, the difference between a shell and a login shell. Provide an example of when we would be working on a shell which is not a login shell.
Q29 - Empty data files It is late and I finally got my revolutionary program to compile and pass its tests. It s time for me to let it run for 20 hours straight while I take off to enjoy my weekend. I therefore issue the following command to have it execute in the background and dump its results in a file I ll look at later; greatprogram > gathered.data & In a hurry I hit ^D several time to log out from my Shell window and come back the following Monday only to find an empty gathered.data file! What did I do wrong? Q30 - Background running jobs What shell command would you issue to display the list of all jobs in that shell and their Job ID? Q31 - Listings What shell command would you issue to display the list of all jobs in that shell and their PID? Q32 - Back and forth What shell command would you issue to bring the job with job ID 5 to the background? Job #5 is not the current or previous job. Job #5 is the one executing the following command vi readme. Q33 - Definitions Describe, in your own words, what a current job Q34 - Spotting the right Describe, in your own words how you would find out which one of your job is the current job.
Q35 - To the foreground! Describe all the possible shell command syntaxes you might use to bring the job with job ID 5 to the foreground? Job #5 is not the current or previous job. Job #5 is the one executing the following command vi readme. Q36 - Bring it back! Explain, in your own words, why it might be useful to bring back to the foreground a job that has been put into the background at some point. Q37 - Ps What does ps stands for? Q38 - BSD Select all, if any, of the following branch of Unix systems is referred to as BSD? AT&T versions U.C. Berkeley versions SUN Microsystems versions Microsoft versions Q39 - Unix Select all, if any, of the following branch of Unix systems is referred to as UNIX? AT&T versions U.C. Berkeley versions SUN Microsystems versions Microsoft versions Q40 - Linux Select all of the following branch of Unix systems, if any, which Linux belongs to? You might have to research this on your own. BSD UNIX
Q41 - Ps Which set of options does the ps shell command support on Linux systems? You may select all, some or none. GNU UNIX BSD Q42 - ps times I started a program 5 hours ago which processed some data and stores it in a file. Intrigued as to why it is not yet completed, I issue a ps -f -p 12345 shell command, with 12345 being the PID of that process. The resulting display indicates in the TIME column a value of 00:53:27. Where are the rest of the 5 hours??? Q43 - Definitions What does the following terms stand for? * CUPS stands for [cups] * FTP stands for [ftp] * DNS stands for [dns] * NFS stands for [nfs] * NTP stands for [ntp] * RPC stands for [rpc] * SSH stands for [ssh] Q44 - Refreshing top What shell command would you issue to have the top utility refresh its output every 60 seconds for 5 minutes? Q45 - Refreshing top What shell command would you issue to have the top utility refresh its output every 60 seconds for 5 minutes and display only information for processes 12345, 54321 and 35142? Q46 - Processes using readme What shell command would you issue to display a list of all processes using a file named readme?
Q47 - Signals What shell command would you issue to display a list of all the signals on your Linux system? Q48 - Sending signals What shell command would you issue to send to process PID 12345 the signal to suspend it? Q49 - Priorities I started 2 hours ago a computation-intensive process in the background and realized that, since it will take many more hours to finish the job, I ought to reduce its priority as much as I am able to. The PID of that process is 12345, what shell command would I issue to set its nice value to 19? Q50 - Daemons vs. demons After watching the exorcist I felt like applying what I ve learned to system administration and decided to display the names of all the daemons running on my Linux system. What shell command would I issue to do so? Q51 - Processes tree display What shell command would I issue to display as a tree the hierarchy of processes which originated from my Bash shell of PID 12345? Q52 - Kill vs. kill -9 Explain, in your own words, the difference between issuing a kill or a kill -9 shell command on a given PID. Q53 - Nice boost I am remotely logged into one of our Linux server as a user and I have to run this computation intensive program. I am able to start it with the myprogram shell command. Since it is late and I am the only one logged on the server, I decide to use the nice command to boost as much as I can the priority of my process. Explain, in your own words, how I would do that.
Q54 - Nice background Let s say that I am logged onto my Linux desktop machine, working with the GUI and about to start a computation intensive program meant to run for 20 hours in one of my terminal windows. Should I use nice to reduce its priority while it runs in the background? Explain, in your own words, why or why not. Q55 - Anyone editing /etc/passwd I m remotely logged into a Linux server as a student and just heard someone in the lab mention that he was editing the /etc/passwd file on that same server! I am not the administrator of that machine and I am pretty sure they are not either. I d like to verify that no one is editing that file right now, how would I do that? Q56 - top I m remotely working as a user on one of our Linux server; the performance is really going down. After using the top utility, I see that one of the process that has been running for few minutes is monopolizing most of the CPU. I decided to get rid of it and issue the kill -9 12345 shell command, where 12345 is the PID of that process. The process is still running. Why?