tmux is a terminal multiplexer. It allows the user to access separate terminal sessions inside a single terminal window.
tmux is especially useful in remote access.
$ sudo apt-get install tmux
For OS X
$ brew install tmux
To start tmux, simply type
tmux. To quit, type
tmux can be controlled using a key combination as a prefix key, (which is Ctrl+b by default), followed by a command. The following are the most frequently used commands.
% split horizontally into two panes " split vertically into two panes ! break the current pane out of the window x kill the current pane c create a new window & kill the current window n switch to the next window p switch to the previous window f promt a search in the current window , rename the current window Left/Right/Up/Down switch to the pane in the specified direction
tmux new -s session_namecreate a new tmux session
tmux attach -t session_nameor
tmux at -t session_nameattache to the session named session_name
tmux switch -t session_nameswitche to the session named session_name
tmux lslist all existing tmux sessions
tmux detachdetach the currently attached session
tmux new-windowcreate a new window
tmux select-window -t :0-9move to the window based on index
tmux rename-windowrename the current window
tmux split-windowsplit vertically into two panes
tmux split-window -hsplit horizontally into two panes
tmux select-pane -[UDLR]switch to the pane in the specified direction
tmux select-pane -t :.+switch to the next pane in numerical order
The configuration of tmux is stored in
Here are some examples how people change their tmux configurations.
Change prefix from Ctrl + b (which is used by vim!) to Ctrl + a.
unbind C-b set -g prefix C-a bind C-a send-prefix
Change pane splitting key-binding into a more intuitive way (~ for splitting vertically and | for splitting horizontally)
bind ~ split-window bind | split-window -h unbind '"' unbind %'"'
You can map vim movement key as tmux movement key
bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R
Use prefix + r to reload configuration.
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."