System and processes
The fg command
Brings a background or stopped job back to the foreground.
Syntax
fg [%N]Most useful options
%NThe job number (fg %1); with no number, the last oneCopy-ready examples
$ sleep 50 & && jobsCheck the job number$ sleep 50 & && fg %1Bring job 1 to the frontYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- The number takes a % in front: fg 1 is not the same as fg %1.
- If the command was sleeping (sleep), returning to the foreground finishes its wait.
FAQ
Why does it say «no such job»?
Because there are no jobs in this terminal: first launch one with & or suspend one with Ctrl+Z.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course