The Wayback Machine - https://web.archive.org/web/20230512155527/https://www.geeksforgeeks.org/fg-command-in-linux-with-examples/
Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

fg command in Linux with examples

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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.
My Personal Notes arrow_drop_up
Last Updated : 15 May, 2019
Like Article
Save Article
Similar Reads
Related Tutorials