Glossary

fg

fg is a shell builtin that resumes a stopped or background job, putting it back in the foreground attached to the terminal. It is the counterpart to Ctrl-Z (which stops the current job) and bg (which resumes a stopped job in the background).

sleep 1000               # run a long-running command
# press Ctrl-Z to stop it
jobs                     # list shell jobs
fg                       # resume the most recent job
fg %2                    # resume job 2
bg                       # resume in the background instead

Job control is a shell feature, not a kernel one: the shell tracks its child processes and their states. fg, bg, jobs, and disown only make sense inside an interactive shell with job control enabled (the default for bash, zsh, fish).

Related terms: bg, jobs, disown, nohup

Discussed in:

This site is currently in Beta. Contact: Chris Paton

Textbook of AI · Textbook of Usability · Textbook of Digital Health

Auckland Maths and Science Tutoring

AI tools used: Claude (research, coding, text), ChatGPT (diagrams, images), Grammarly (editing).