Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt

Use this file to discover all available pages before exploring further.

Bash job suspension is the mechanism by which a running process (job) is temporarily halted by the operating system’s kernel, removing it from the CPU’s scheduling queue without terminating it. This state is managed via POSIX signals and the Bash job control facility, allowing the process to be held in memory—retaining its execution context, file descriptors, and memory allocations—until explicitly resumed. When a job is suspended, it transitions from a Running state to a Stopped state. The shell intercepts the state change and updates its internal job table, returning control of the terminal (TTY) to the Bash prompt.

Signal Implementation

Job suspension is driven by two specific POSIX signals:
  • SIGTSTP (Terminal Stop): Typically generated by the terminal driver when the user inputs the suspend character. Processes can catch, handle, or ignore this signal.
  • SIGSTOP (Stop): A forceful suspension signal sent programmatically. The kernel handles this directly; the target process cannot catch, block, or ignore it.
To resume a suspended job, the kernel must receive a SIGCONT (Continue) signal directed at the process.

Syntax and Commands

Suspending a Foreground Job The default terminal suspend keystroke sends a SIGTSTP to the foreground process group.

# While a foreground process is running, input the suspend character:
Ctrl+Z
Standard Shell Output:
[1]+  Stopped                 <command_name>
Suspending via Process ID (PID) You can suspend any process programmatically by sending SIGSTOP or SIGTSTP using the kill command.

# Send SIGSTOP (uncatchable)
kill -SIGSTOP <pid>


# Send SIGTSTP (catchable)
kill -SIGTSTP <pid>
Querying Suspended Jobs The jobs builtin reads the shell’s internal job table to display the status of all jobs associated with the current session.
jobs -s  # The -s flag restricts output to only suspended (stopped) jobs
Standard Shell Output:
[1]-  Stopped                 sleep 200
[2]+  Stopped                 top
(Note: + denotes the current default job, - denotes the previous default job). Resuming Suspended Jobs Bash provides builtins that automatically send the SIGCONT signal to resume execution. The fg command sets the terminal’s foreground process group to match the job’s existing process group (granting it TTY control via tcsetpgrp), while bg simply sends SIGCONT to the process group without altering terminal control.

# Resume a suspended job in the foreground (regains TTY control)
fg %<job_number>


# Resume a suspended job in the background (runs asynchronously without TTY control)
bg %<job_number>
Resuming via Process ID If bypassing Bash job control, you must manually send the continuation signal to the suspended process.
kill -SIGCONT <pid>
Master Bash with Deep Grasping Methodology!Learn More