Detach from tmux sessions

In case you are in tmux and want to return back to you terminal you need to detach tmux. Doing this in the most convenient way is with the keybinding <prefix> d.

This will return you to your terminal and keep the tmux session running. So you can attach to it later with tmux attach. If you don’t want to keep the session running, than kill-session is what you’re looking for.

If necessary, for example when you’re scripting against tmux, you can use the command to detach as well. Running the command will detach your current tmux session. Optionally you can pass a different target session to the -s option to detach another actively running session.

$ tmux detach-client

Tmux provides a shorter notation for the above command as well. Which is just simply detach.

$ tmux detach

Learn more

A great resource for learning more about tmux are its man pages. You can read them online here or from the command-line using the following command:

$ man tmux

Or take a look at this book:

See Also

6 Non-Programming Books for Programmers