-->

Suspended Jobs vs Running jobs in Linux

Background Job : A job which is running background in the same shell. You can use bg command to see any background jobs.
Foreground job : A Job which is running in the same shell right before your eyes.
Suspended Job : Its a stopped/pause job but you can resume their running.
Let me explain with example very clealy
virt00# sleep 180
^Z
zsh: suspended  sleep 180
virt00# jobs
[1]  + suspended  sleep 180
virt00# bg
[1]  + continued  sleep 180
virt00# fg
[1]  + running    sleep 180
^Z
zsh: suspended  sleep 180
virt00# jobs
[1]  + suspended  sleep 180
virt00#
I have started a Job named sleep 180 then I stopped with CTRL+Z . right now my job is in suspended mode.
I see it by typing jobs command. Now I want to resume its running in background so I typed bgcommand then it will move from suspended state to running state but in background it will run.
now I typed command fg to bring it foreground , now job wont get stepped but it will pull from background jobs queue and push into foreground jobs queue.
So yes background jobs and foreground jobs always are in running state.
Share on Google Plus

About RAJA SEKHAR REDDY GENUPULA

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.