# Foreground and Background Processes

* Usually when running a command in the command shell, the user has to wait for the process to finish before he can do anything else.
* The command is being run as a **foreground process**.
  * Only one foreground process can be running in a shell at a time.

![](/files/7i2YKcJjlXOrnUZ1x3U7)

* A user can have more **background processes** running at the same time.
* Start a process in the background with **`&`**

![](/files/w3EAULcAQGk6wcpTn09t)

* Currently running processes can be moved from the foreground to the background and viceversa.
  * **`CTRL+Z`** - suspend/pause the process
  * **`jobs`** - list the active jobs
  * **`bg`** - move the process to the background
  * **`fg`** - move the process back to the foreground

![](/files/SmTl2nykBA1baZQGQiez)

![](/files/446ACBe35ivaoEgQ36RY)

* **`+`** = fg/bg commands operate on the + process
  * use the job number to fg/bg that process

### jobs

* **`jobs`** - list all the active jobs

### fg / bg

* **`fg`** - move jobs to the foreground
* **`bg`** - move jobs to the background

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blog.syselement.com/tcm/courses/linux-101/8-process-manag/process-fg-bg.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
