tmux Cheat Sheet ================ **Table of Contents** * [Shortcuts](#shortcuts) * [Scripting TMUX](#scripting-tmux) * [Configuring TMUX](#configuring-tmux) * [Further Resources](#further-resources) Shortcuts ========= | Key(s) | Description | | :-----: | ----------- | | `CTRL`+`b` `` | sends `` to tmux instead of sending it to the shell | | | **Working with Panes** | | % | split window vertically | | - | split window horizontally | | → | go to right pane | | ← | go to left pane | | ↑ | go to upper pane | | ↓ | go to lower pane | Scripting TMUX ============== Starting multiple commands in multiple panes -------------------------------------------- Start a new tmux session with `tmux` before running the script! ``` sh #!/bin/bash SESSION=$USER tmux -2 new-session -d -s $SESSION tmux new-window -t $SESSION:1 -n "TMUX-Test" tmux split-window -h tmux select-pane -t 0 tmux send-keys "echo 'pane1'" C-m tmux select-pane -t 1 tmux send-keys "echo 'pane2'" C-m tmux split-window -v tmux send-keys "echo 'pane3'" C-m ``` Configuring TMUX ================ You can configure tmux via the `~/.tmux.conf` file. After making changes to the config file, you can update the configuration "on-the-fly" with tmux source ~/.tmux.conf Adding Mouse Support for Mac OS X --------------------------------- In order to have mouse support in Mac OS X, you can add the following lines to your config file: ``` sh set -g mode-mouse on set -g mouse-resize-pane on set -g mouse-select-pane on set -g mouse-select-window on ``` Further Resources ================= * [tmuxinator](https://github.com/tmuxinator/tmuxinator) * [tmux shortcuts & cheatsheet](https://gist.github.com/MohamedAlaa/2961058) * [tmux tutorial](http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/) * [Mouse support in OS X](http://www.davidverhasselt.com/enable-mouse-support-in-tmux-on-os-x/) * [(Video) Basic tmux Tutorial - Windows, Panes, and Sessions over SSH tutoriaLinux](https://www.youtube.com/watch?v=BHhA_ZKjyxo)