Forrest logo
tool overview
On this page you find all important commands for the CLI tool bg. If the command you are looking for is missing please ask our AI.

bg

The "bg" command is a built-in command line tool in Unix-based operating systems. It is used to send a suspended or stopped process to the background, allowing it to continue running without blocking the command line interface.

When you run a command in the foreground, it normally occupies the command prompt until it completes, and you cannot give any new commands until it finishes. However, if you want to run a process in the background, you can suspend it using the "Ctrl + Z" key combination, and then use the "bg" command to let it continue running in the background.

The syntax for the "bg" command is as follows:

bg [%job_id]

Here, the optional "job_id" is the ID of the suspended job you want to send to the background (you can find the job ID using the "jobs" command). If you don't provide a job ID, the "bg" command acts on the most recent job.

Once a process is running in the background, it won't occupy the command prompt anymore, and its output will not be displayed directly on the screen. If you want to bring it back to the foreground, you can use the "fg" command.

Overall, the "bg" command is useful for managing processes and running tasks in the background while you continue working in the command line interface.

List of commands for bg:

  • bg:tldr:5523c bg: Resume the most recently suspended job and run it in the background.
    $ bg
    try on your machine
    explain this command
  • bg:tldr:f0e08 bg: Resume a specific job (use `jobs -l` to get its ID) and run it in the background.
    $ bg %${job_id}
    try on your machine
    explain this command
tool overview