> For the complete documentation index, see [llms.txt](https://wilmerags.gitbook.io/digital-garden/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wilmerags.gitbook.io/digital-garden/linux/tmux.md).

# Tmux

Frequently used for tmux

## Recipes

* `Ctrl+b "` — split pane horizontally.
* `Ctrl+b %` — split pane vertically.
* `Ctrl+b arrow key` — switch pane.
* Hold `Ctrl+b`, don’t release it and hold one of the arrow keys — resize pane.
* `Ctrl+b c` — (c)reate a new window.
* `Ctrl+b n` — move to the (n)ext window.
* `Ctrl+b p` — move to the (p)revious window.

**To create session**

`tmux new -s sess_name`

**To attach a session**

`tmux a -t sess_name`

**To create a session in detached mode**

`tmux new -d -s sess_name`

**To send commands to a session to the pane 0**

`tmux send-keys -t sess_name.0 "pwd" ENTER`

**To split panes horizontally in detached mode 1(right) and 0(left)**

`tmux splitw -h -p 50 -t sess_name:1.0`

**To kill tmux server**

`tmux kill-server`

**To kill tmux session**

`tmux kill-session -t sess_name`

**To kill all other sessions from a session**

`tmux kill-session -a`

## Resources

* [tmux: Productive Mouse-Free Development](http://pragprog.com/book/bhtmux/tmux)
* [How to reorder windows](http://superuser.com/questions/343572/tmux-how-do-i-reorder-my-windows)
* [tmux Tutorial — Split Terminal Windows Easily - Lukasz Wrobel](https://lukaszwrobel.pl/blog/tmux-tutorial-split-terminal-windows-easily/)
