> For the complete documentation index, see [llms.txt](https://blog.syselement.com/tcm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://blog.syselement.com/tcm/courses/linux-101/8-process-manag/process-fg-bg.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
