DebugPointer
Published on

How to exit Tmux session

How to exit Tmux session

Tmux is one of the most useful tool when it comes to using a linux terminal.

Tmux is a terminal multiplexer, it allows a user to access multiple terminals (or windows), each running a separate program, while providing a single screen to work on. Tmux is useful for running more than one command-line program at the same time, increasing productivity and the way you work.

Let's consider the default prefix for tmux, which is Ctrl-B and let's go over the commands below using the same.

Let's look at how to exit a tmux session.

Exit a tmux session - keyboard shortcuts

Let's say you are inside a tmux session. To exit a detach from a tmux session, you have to just use the following keyboard shortcuts.

Then, you can do the following keyboard default shortcut-

Ctrl-B + d

It's a series of 2 keyboard keysets you will have to press. You have to press Ctrl-B, then release the keys, then press d right after that.

OR

You can also run the tmux command in the command line to kill the pane-

tmux kill-session -t <session-name>

So, for example, if you want to kill the pane number 2, you can just run the following command -

tmux kill-session -t 2

You can also kill a tmux pane or window without exiting from tmux and exit from nested tmux sessions as well. You can reset a tmux config in case you feel some of your tmux plugins are not working as expected and start with a clean config.

I hope this tutorial for killing panes and windows in tmux was useful. You can also check out the complete tmux cheatsheet of keyboard shortcuts and mouse shortcuts.