Tmux
Document common information about tmux.
Hotkey
Tmux uses hotkey twice. The default first one is fixed to Ctrlb, and some common second hotkeys(1) are listed below.
Second Hotkey | Description |
---|---|
: | Activate the command input mode, then you can use the commands listed in the Commands section of this page. |
d | Detach the current client. |
" | Split the current pane into two, top and bottom. |
% | Split the current pane into two, left and right. |
0 - 9 | Select windows 0 to 9. |
[ | Enter copy mode to copy text or view the history. |
] | Paste the most recently copied buffer of text. |
c | Create a new window. |
x | Kill the current pane. |
& | Kill the current window. |
f | Prompt to search for text in open windows. |
, | Rename the current window. |
Commands
Command | Description |
---|---|
set -g mouse on | Turn on mouse mode, in which you can switch the window grid or scroll the screen. |
set -g default-terminal "screen-256color" | Change the color scheme to screen-256color , which is the default scheme for the Linux shell. |
kill-session -t id/name | Kill the session specified by id or name. |
source /path/to/tmux.conf | Apply /path/to/tmux.conf to the current tmux server. |
Configuration File
When the tmux server is started, tmux runs a file called .tmux.conf in the user's home directory. This file contains a list of tmux commands which are executed in order.
.tmux.conf can only be applied when the tmux server is started or when running
source path/to/.tmux.conf manually in command input mode,
not when a new session is created.[a]
For example, add the following commands (2) to .tmux.conf, then reopen a new terminal and run tmux to start tmux server.
- Versions after (and including) 2.1
set -g mouse on set -g default-terminal "screen-256color"
- Versions before 2.1
set -g mode-mouse on set -g mouse-resize-pane on set -g mouse-select-pane on set -g mouse-select-window on