GNU/Linux Command – FG

fg — Place a job in the ForeGround.


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

$ sleep 100 & -- Start a dummy job in background. $ fg -- Move the last job to foreground. $ sleep 150 & -- Dummy job 1 $ sleep 140 & -- Dummy job 2 $ sleep 130 & -- Dummy job 3 $ jobs -- List all active jobs. $ fg 2 -- Move the 2nd active job to foreground.
Read: help fg, jobs

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: