How to Run a Process in the Background with TMUX

There are times when you need to log off your Linux Desktop, and you want a process to run in the background. 
TMUX manages this very well.

For this example, let's suppose you're running a long-running task like running `rspecs` on your project and
it is 5pm, and you need to go home.

## Run Your Process

### 1. First launch TMUX

```
$ tmux
```

### 2. Run your long-running process

```
$ bundle exec rspec spec
```

### 3. Detach from TMUX

Simply press `[CTRL]+[b]`, then `[d]`. This will detach your session from TMUX

### 4. Log off

Now you can simply log off

## Return to your session

When you return to your desktop, open a terminal and simply run:

```
$ tmux attach
```

OR 

```
$ tmux a
```

This will attach to your detached TMUX session. 

## Other Helpful Hints:

* **Create a new tab:** `[CTRL]+[b], [c]`
* **Switch to tab number:** `[CTRL]+[b], `
* **Enable Scrolling up / Page up:** `[CTRL]+[b], [`

Leave a Reply

Your email address will not be published. Required fields are marked *

GaminZone – Expert Gaming Guides, Game News & Pro Tips
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.