๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

โš™๏ธ Process Management March 18, 2026 182

Linux Command: fg

Bring a background job to the foreground

Terminal โ€” Process Management
Command
$ fg
Output
Resumes the most recent background/suspended job in the foreground.

The fg command brings a background or suspended job to the foreground, making it the active process in your terminal. It is the complement to bg โ€” fg brings jobs forward, bg sends them back. fg is a shell built-in used for job control. Without arguments, it brings the most recent background/suspended job to the foreground. With %N, it brings a specific job number. This command is essential for interacting with background processes โ€” for example, bringing a text editor back to the foreground after checking something in the shell.

Syntax

fg [JOB_SPEC]

Common Examples

  • fg โ€” Resumes the most recent background/suspended job in the foreground.
  • fg %2 โ€” Brings job number 2 to the foreground.
  • fg %vim โ€” Brings the job whose command starts with "vim" to the foreground.
  • vim file.txt # Press Ctrl+Z to suspend ls -la # Check files fg # Back to vim โ€” Suspend editor, run a quick command, return to editor.

Pro Tips

    Master this and 230+ other Linux commands with our comprehensive eBooks and cheat sheets.

    Share this tip