How do I use job control in linux?
indigowinged last edited by indigowinged
sleepcommand example from the article above.
If you have a command that has been running on the shell prompt for a long time and you want to stop it (not kill it) you can use Bash job control.
For example the following sleep command will run for 300 seconds on the shell prompt, we press
control-z, the process is suspended.
$ sleep 300 ^Z + Stopped sleep 300 $
See the job control status.
$ jobs + Stopped sleep 300 $
To continue running the sleep process in the background. Use the built-in bash command
$ bg %1 + sleep 300 & $ jobs + Running sleep 300 & $
To bring back the sleep process into foreground again. It will wait until 300 seconds have been reached and finish. Use the built-in bash command
$ fg %1 sleep 300
The job number in square brackets is incremented for each job. The
%1is the job specification, job number 2 would be referred to as
© Lightnetics 2022