> 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.

![](https://1178537843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2KUxfxUFmy000PDT7MtM%2Fuploads%2Fgit-blob-fd616e33135bac35c2410b0808e3967af85a1fca%2Fimage-20221029115152902.png?alt=media\&token=88b2eeda-808c-40ac-b396-c0cbfefeadeb)

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

![](https://1178537843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2KUxfxUFmy000PDT7MtM%2Fuploads%2Fgit-blob-81260560cbd7f6a4972c01bb7bf786e8278b1701%2Fimage-20221029115331049.png?alt=media)

* 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

![](https://1178537843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2KUxfxUFmy000PDT7MtM%2Fuploads%2Fgit-blob-2cc74fc7ab9ccfc22b6f0669d5ac6234f3244dce%2Fimage-20221029120001281.png?alt=media)

![](https://1178537843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2KUxfxUFmy000PDT7MtM%2Fuploads%2Fgit-blob-3c823e5227dfb085f52a12e70ba9d92dab219a71%2Fimage-20221029120425744.png?alt=media\&token=e3881fb4-4223-46c8-8a6c-4cfa2ae0b81b)

* **`+`** = 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

***
