fg command in Linux with examples
fg command in linux used to put a background job in foreground.
Syntax:
fg [job_spec]
job_spec may be:
%n: Refer to job number n.
%str: Refer to a job which was started by a command beginning with str.
%?str: Refer to a job which was started by a command containing str.
%% or %+: Refer to the current job. fg and bg will operate on this job if no job_spec is given.
%-: Refer to the previous job.
Options for fg command :
- fg [JOB_SPEC] : This command is used to put the mentioned job running inbackground to foreground.

“sleep 500” is a command which is used to create a dummy job which runs for 500 seconds. - fg –help : It displays help information.
Recommended Posts:
- dc command in Linux with examples
- atd command in Linux with examples
- for command in Linux with Examples
- last command in Linux with Examples
- cp command in Linux with examples
- scp command in Linux with Examples
- id command in Linux with examples
- cut command in Linux with examples
- look command in Linux with Examples
- cpp command in Linux with Examples
- tee command in Linux with examples
- env command in Linux with Examples
- arp command in Linux with examples
- help Command in Linux with examples
- cd command in Linux with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



