🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

⚙️ Process Management March 18, 2026 88

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