Skip to content

Instantly share code, notes, and snippets.

@davydany
Last active May 3, 2024 14:52
Show Gist options
  • Star 35 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save davydany/d33f4b5e19eab6b805b045b91d3cf858 to your computer and use it in GitHub Desktop.
Save davydany/d33f4b5e19eab6b805b045b91d3cf858 to your computer and use it in GitHub Desktop.
Using TMUX for running processes after you log off

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 back 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], <number>
  • Enable Scrolling up / Page up: [CTRL]+[b], [
@jnhong
Copy link

jnhong commented Oct 15, 2021

Thanks for this!

@MichaelaPasler
Copy link

Thank you!

@izulwahidin
Copy link

Thanks

@Bug-Reaper
Copy link

Much appreciated <3

@alexandrule
Copy link

❤️

@hpacleb
Copy link

hpacleb commented Feb 4, 2023

Very helpful, thanks!

@seyyedaliayati
Copy link

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment