I just wanted to make sure that I understand the foreground and background process. Let's say, I have a program Hello_world.

If I want to start the program I type in the foreground:


Then if I want to continue Hello_world in the background I type:

bg Hello_world

If I want to kill the job I type:

kill -9 %(job#) 

Also, how would I check to see if the job is terminated?

2 Answers 2


If you type:


It should tell you what status are your background jobs in.

See manual for further info.


./job &

Now it is running on background.

You can kill it by:

kill %1

or use any switch like:




In any case in the end you would like to see:

[1]+  Terminated              ./job

And this is done again by jobs command.


Great explanation by @Vlastimil. I would add only that you can jump between foreground / background:

fg %background_job_ID


fg %2

and now you brought it to foreground, you are in that context, meaning that you can:

pause (stop/suspend): Ctrl+Z

interrupt:      Ctrl+C   (this will typically cause the process to terminate; i.e., exit)

During all of this you can see what is running, what is paused and what is terminated by executing the jobs command.

But yeah, that is kind of the main aspects of background / foreground via shell management.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .