GNU/Linux Command – BG

bg — Place a job in BackGround

Summary:

Normally user can run a job in background, by adding & at end of the command (ex: sleep 10 &). bg is a built-in shell command. It is used to move a job from foreground to the background, as if it had been started with `&’. If JOB is not present, the shell’s notion of the current job is used.

Examples:
$ sleep 100 -- Start a dummy job in foreground. Press Ctrl+z to stop the current job. $ bg -- Move the last stopped job to background. $ sleep 150 -- Dummy job 1 Press Ctrl+z to stop the current job. $ sleep 140 -- Dummy job 2 Press Ctrl+z to stop the current job. $ sleep 130 -- Dummy job 3 Press Ctrl+z to stop the current job. $ jobs -- List all active jobs. $ bg 2 -- Move the 2nd active job to background.
Read: help bg, jobs

Advertisements
Tagged with: ,
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: