Linux · Systems fluency

How does shell job control work?

Mediumjob-controlshellbackgroundUpdated Oct 2026
Quiz this track

Short answer

Job control lets an interactive shell manage groups of processes attached to a terminal. You can suspend the foreground job, resume it in the background, list jobs, and bring one back to the foreground.

Each job is a process group with a job number local to the shell. The terminal has one foreground process group; background jobs that try to read from the terminal are stopped by the kernel until they are brought forward.

sh
sleep 300 &
jobs -l
fg %1
bg %1

The keyboard and commands

  • Ctrl-Z sends SIGTSTP and suspends the foreground job
  • Ctrl-C sends SIGINT and usually terminates the foreground job
  • jobs lists jobs, fg resumes one in the foreground, bg resumes one in the background
  • nohup ignores SIGHUP so a process can survive a terminal disconnect
  • disown removes a job from the shell job table

When an interactive SSH session closes, the terminal sends SIGHUP to its jobs. Long-running work should run under systemd, tmux, or screen rather than relying on a background ampersand from a login shell.

Job control is interactive. Cron jobs and systemd services have no controlling terminal, and scripts do not get a job table in the same way.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1What happens to background jobs when an SSH session closes?
  2. 2Why does a background process sometimes stop instead of running?
  3. 3What is the difference between nohup and disown?
  4. 4How would you keep a long-running process alive without job control?

Say it in the interview

Job control is a shell feature for managing process groups attached to a terminal. Ctrl-Z suspends the foreground job, bg resumes it in the background, and fg brings it back. A background job that reads from the terminal gets stopped because it is no longer the foreground group. For durable work I use systemd or a terminal multiplexer rather than a background ampersand.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Linux mock interview and get scored feedback on depth, clarity and confidence.