Start tmux as a session so that in case of a disconnection you session is still active on the host.
Create new tmux session
tmux new -s session-name
Attach to a session
tmux ls
tmux attach -t session_name
Default prefix key is ⌃ + b but we have changed it to ⌃ + a
Detach from a Session
⌃ + a d
Rename a session
⌃ + a ,
Move to Copy Mode
⌃ + a [
Use page up and page down to move around. Hit space to enter into copy mode, select text, hit ⏎ Enter to copy into the vim buffer. Open vim to paste
⌃ + a ] to paste
Send window to a pane
⌃ + a s
Veritcal split
⌃ + a % to paste
Horizontal split
⌃ + a "
Move around in windows
⌃ + a ↑↓←→
Zoom in/out to any windows
⌃ + a z
Resize a window
⌃ + a ^↑↓←→ hold ctrl in this case
Move the window to other layout
⌃ + a {
Move the window to other layout
⌃ + a }
Change the layout
⌃ + a space
Toggle (start/stop) logging in the current pane.
- Key binding: ⌃ + a shift+p
- File name format:
tmux-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log
- File path:
$HOME
(user home dir)- Example file:
~/tmux-my-session-0-1-20140527T165614.log
- Example file:
Save visible text, in the current pane. Equivalent of a "textual screenshot".
- Key binding: ⌃ + a alt+p
- File name format:
tmux-screen-capture-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log
- File path:
$HOME
(user home dir)- Example file:
tmux-screen-capture-my-session-0-1-20140527T165614.log
- Example file:
Save complete pane history to a file. Convenient if you retroactively remember you need to log/save all the work.
- Key binding: ⌃ + a alt+shift+p
- File name format:
tmux-history-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log
- File path:
$HOME
(user home dir)- Example file:
tmux-history-my-session-0-1-20140527T165614.log
- Example file:
NOTE: this functionality depends on the value of history-limit
- the number
of lines Tmux keeps in the scrollback buffer. Only what Tmux kept will also be saved, to a file.
Use set -g history-limit 110000
in .tmux.conf, with modern computers
it is ok to set this option to a high number.
Key binding: ⌃ + a alt+c
This is just a convenience key binding.