Job Control


The "control-Z" is used for job control. When you type "ctrl-Z" the current job (running program) is suspended or stopped. A job that is suspended is in total limbo. No cpu time is being used, BUT the shell is waiting for you to do SOMETHING with it. The choices are to kill it, run it in the background, or bring it back to the foreground. Until you do one of those 3 for those suspended jobs, the shell will not let you logout on your first try. The csh provides commands that let you control jobs. One is the "jobs" command. It will show all your jobs, both in running and suspended. Two other commands are "fg" and "bg". They will take the latest job and bring it to the foreground or background. Often you might want to kill a job. The "kill" command will kill a suspended or background running job. One short-cut to remember is that the shell will replace the %1 with the process id of job number 1, %2 with the process id of job number 2, etc... "fg" and "bg" will take simply the job number. So... the following command would kill the most current job suspended: unix-prompt> kill -9 %1 And.... the following command would start the most recently suspended job running in the background. unix-prompt> bg




Comments to: webmaster@dca.fee.unicamp.br
Revised: April 9, 1996
URL: http://www.dca.fee.unicamp.br/sysadmin/helpstuff/job_control.html
Copyright © 1996 - DCA