Recover a suspended or backgrounded task into interactive control with a single shell command. 13.03.2026 | reading time: 2 min Need to regain interactive control of a task you suspended or sent to the background? The shell builtin `fg` pulls a job from the shell's job table into the foreground so you can interact with it directly. Practical demo Start a command, suspend it, then bring it to the foreground; follow the prompts exactly: ```$ sleep 100 ^Z [1]+ Stopped sleep 100 $ jobs [1]+ Stopped sleep 100 $ fg %1 sleep 100 ``` How and when to use it `fg` accepts a job specification and restores that job to the foreground; use short forms like `%1`, `%%` or `%-` to pick a job. It is ideal when an interactive program was suspended with Ctrl-Z or when you backgrounded a process and realize you need to interact with it; remember that job control is a feature of interactive shells, so `fg` will not work in non-interactive scripts unless job control is explicitly enabled. Companion commands to know Use `jobs` to inspect the job list and job numbers, `bg` to resume a stopped job in the background, and `disown` to detach a job from the shell so it won't be killed on logout; also remember `kill` and `jobs -l` for PIDs when you need finer control. Final thought Mastering job control with `fg` sharpens interactive troubleshooting and workflow efficiency; keep exploring shell builtins and consider formal certification like CompTIA Linux+ or LPIC-1, and intensive exam preparation at bitsandbytes.academy can help you get there. Join Bits & Bytes Academy First class LINUX exam preparation. processes utilities scripting troubleshooting