# How to run WP-CLI in the background

If you have a lot of images to resize, you can run WP-CLI in the background so you don't need to wait for the process to finish. In this quick guide, I'll show you how you can run the command `wp media regenerate` in the background:

1. Install [WP-CLI](https://wp-cli.org/#installing)
2. Open your server terminal
3. Type the command  `nohup wp media regenerate --yes`  followed by **`&`**

```bash
$ nohup wp media regenerate --yes &
```

This will run regeneration in the background and print the process identifier number of the job:

```bash
[1] 22699
```

To view regenerated thumbnails log, type:&#x20;

```bash
$ cat nohup.out
```

To list running jobs, type the command `jobs`

```bash
$ jobs
```

The output will be similar to this:

```bash
[1]+  Running                 nohup wp media regenerate --yes & 
```

To stop regeneration, use the command `kill` and the job number in  `[1]+`

```bash
$ kill %1
```

**Note**: If you ended the terminal session, you will need to use the command `ps -eaf | grep wp` instead of `jobs` to list running jobs:

```bash
ps -eaf | grep wp
```

The output will be similar to:

```bash
501 22699 22389   0  3:19PM ttys000    0:00.14 wp media regenerate --yes
```

To terminate the job process, use the identifier number to terminate it:

```bash
kill 22699
```
