fg command in Linux with Examples Last Updated : 06 Nov, 2025 Comments Improve Suggest changes 6 Likes Like Report The fg command in Linux is used to bring a background job to the foreground. It allows you to interact with the process directly through the terminal.Resumes a background or stopped job in the foreground.Useful for switching back to a process that was sent to the background with bg 0r &.Example:Command:sleep 60 &fg %3 Syntaxfg [job_spec]The job_spec is a way to refer to the background jobs that are currently running or suspended. Here are some common ways to specify a job:%n: Refers to job number n.%str: Refers to a job that was started by a command beginning with str.%?str: Refers to a job that was started by a command containing str.%% or %+: Refers to the current job (this is the default job operated on by fg if no job_spec is provided).%-: Refers to the previous job.Key Options for the fg command1. fg [JOB_SPEC]:This is the primary use of the fg command, bringing a specified job running in the background back to the foreground. For example, if you create a dummy job using sleep 500, you can bring it back to the foreground by referencing its job number:"sleep 500" is a command which is used to create a dummy job which runs for 500 seconds. 2. fg --help:This option displays help information for the fg command, explaining usage and available options. Create Quiz Comment D DrRoot_ Follow 6 Improve D DrRoot_ Follow 6 Improve Article Tags : Technical Scripter Linux-Unix Technical Scripter 2018 linux-command Linux-system-commands +1 More Explore Linux/Unix Tutorial 5 min read Getting Started with LinuxWhat is Linux Operating System 8 min read LINUX Full Form - Lovable Intellect Not Using XP 2 min read Difference between Linux and Windows 7 min read What are Linux Distributions ? 8 min read Difference between Unix and Linux 5 min read Installation with LinuxHow to Install Arch Linux in VirtualBox? 7 min read Fedora Linux Operating System 12 min read How to install Ubuntu on VirtualBox? 6 min read How to Install Linux Mint? 3 min read How to Install Kali Linux on Windows? 2 min read How to Install Linux on Windows PowerShell Subsystem? 2 min read How to Find openSUSE Linux Version? 2 min read How to Install CentOS 2 min read Linux CommandsLinux Commands 15+ min read Essential Unix Commands 7 min read Find Command in Linux with Examples 7 min read Linux File SystemLinux File System 12 min read Linux File Hierarchy Structure 5 min read Linux Directory Structure 6 min read Linux KernelLinux Kernel 4 min read Kernel in Operating System 3 min read How Linux Kernel Boots? 11 min read Difference between Operating System and Kernel 3 min read Linux Kernel Module Programming: Hello World Program 7 min read Linux Loadable Kernel Module 7 min read Loadable Kernel Module - Linux Device Driver Development 4 min read Linux Networking ToolsNetwork configuration and troubleshooting commands in Linux 5 min read How to configure network interfaces in CentOS? 5 min read Command-Line Tools and Utilities For Network Management in Linux 8 min read Linux - Network Monitoring Tools 4 min read Linux ProcessProcesses in Linux/Unix 5 min read How to Manage Process in Linux 4 min read Getting System and Process Information Using C Programming and Shell in Linux 2 min read Process states and Transitions in a UNIX Process 4 min read Linux FirewallLINUX Firewall 7 min read iptables command in Linux with Examples 7 min read How to Configure your Linux Firewall - 3 Methods 12 min read Shell Scripting & Bash ScriptingIntroduction to Linux Shell and Shell Scripting 7 min read What is Terminal, Console, Shell and Kernel? 5 min read How to Create a Shell Script in linux 7 min read Shell Scripting - Different types of Variables 4 min read Bash Scripting - Introduction to Bash and Bash Scripting 12 min read Bash Script - Define Bash Variables and its types 12 min read Shell Scripting - Shell Variables 6 min read Bash Script - Difference between Bash Script and Shell Script 4 min read Shell Scripting - Difference between Korn Shell and Bash shell 3 min read Shell Scripting - Interactive and Non-Interactive Shell 3 min read Shell Script to Show the Difference Between echo â$SHELLâ and echo â$SHELLâ 4 min read Like