Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to control the process in foreground and background

Tags: background

A program in execution is called process. each process will have unique process id.

How do I differentiate the process is running in foreground/background ?
if the user needs to wait for the result of the program, then the job is running in foreground. This also means if the user log out the terminal, then the job will get killed. In case of back ground jobs , when the user runs the program, he will run with (&) symbol where he will get the job id of the process running in background.

How I can run the programs in background ?
program_name arguments_input &
or
nohup program_name arguments_input &

How do I know how many jobs are running in background ?
jobs command will allow the user to know the jobs running in background with job id

How do I can move the process from foreground to background ?

  1. run the process in foreground
  2. press control+z, the process will get stopped
  3. and run immediately with the command bg
How do I move the process from background to foreground ?

run the jobs command and view the job id of the program that we want to move to foreground.
fg %job_id
fg %starting name of process
will allow the process to move from background to foreground


This post first appeared on All About Linux, please read the originial post: here

Share the post

How to control the process in foreground and background

×

Subscribe to All About Linux

Get updates delivered right to your inbox!

Thank you for your subscription

×