Detach from tmux sessions
March 23, 2020 ‐ 2 min read
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
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
$ tmux detach
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: