bg - macOS


The bg command in macOS resumes suspended jobs in the background, allowing them to continue running without occupying the terminal directly. Primarily used in multi-tasking environments, it is instrumental when you need to continue working in the terminal without interruption from ongoing processes.


The basic syntax of the bg command is:

bg [job_spec]
  • [job_spec]: Optional parameter that specifies the job to put in the background. If no job_spec is provided, the most recent job is used.


The bg command doesn’t typically have options or flags. Its functionality is straightforward, focusing on resuming suspended jobs in the background.


  1. Resuming the Most Recent Job:
    If you’ve just suspended a job by pressing Ctrl + Z, you can resume it in the background simply by typing:

  2. Resuming a Specific Job:
    If multiple jobs are suspended, you can list them with the jobs command and then resume a specific one using its job number:

    bg %1

    Here, %1 refers to the job number which is typically shown at the beginning of the line when using the jobs command.

Common Issues

  • No Current Job:
    If there are no recently suspended jobs, the bg command will return an error. Always ensure a job is suspended before using bg.

  • Job Spec Error:
    If an incorrect job spec is given, such as a non-existent job number, the bg command will also return an error. Double-check job numbers by using the jobs command.


The bg command integrates well with job control and other shell features. A common use case involves combining bg with jobs, fg for foregrounding jobs, and kill for terminating jobs:

# Suspend the current job
Ctrl + Z
# List all jobs
# Resume job number 1 in the background
bg %1
# Eventually bring the job back to foreground if needed
fg %1
  • fg: Brings jobs to the foreground, allowing for interactive continuation.
  • jobs: Lists the current jobs along with their statuses.
  • kill: Sends a signal to a job, commonly used to terminate a job.

You can find more details in the official Bash documentation or the macOS terminal manual pages accessible via the man command, such as man bash for shell built-ins or man kill for signal-related commands.