> tmux
terminal multiplexer — manage sessions, windows, and panes from a single terminal
// sessions
16 commandsStart a new session
$ tmuxStart a new session with the name mysession
$ tmux new -s mysessionStart a new session or attach to an existing session named mysession
$ tmux new-session -A -s mysessionAttach to last session
$ tmux aAttach to a session with the name mysession
$ tmux a -t mysessionShow all sessions
$ tmux lsSession and Window Preview
Ctrl + bw
Detach from session
Ctrl + bd
Choose which client to detach
Ctrl + bD
Move to previous session
Ctrl + b(
Move to next session
Ctrl + b)
Rename session
Ctrl + b$
kill/delete the current session
: kill-sessionkill/delete session mysession
$ tmux kill-ses -t mysessionkill/delete all sessions but the current
$ tmux kill-session -aKill tmux server and all sessions
$ tmux kill-server// windows
15 commandsstart a new session with the name mysession and window mywindow
$ tmux new -s mysession -n mywindowCreate window
Ctrl + bc
Rename current window
Ctrl + b,
Close current window
Ctrl + b&
Previous window
Ctrl + bp
Next window
Ctrl + bn
Switch/select window by number
Ctrl + b0...9
Toggle last active window
Ctrl + bl
Prompt for a window index to select
Ctrl + b'
Find window by name
Ctrl + bf
Move current window to a specific index
Ctrl + b.
Reorder window, swap window number 2(src) and 1(dst)
: swap-window -s 2 -t 1Move current window to the left by one position
: swap-window -t -1Move window to another session
: move-window -s src_ses:win -t target_ses:winRenumber windows to remove gap in the sequence
: move-window -r// panes
19 commandsSplit the current pane with a vertical line to create a horizontal layout
: split-window -hSplit the current pane with a horizontal line to create a vertical layout
: split-window -vClose current pane
Ctrl + bx
Toggle pane zoom
Ctrl + bz
Switch to pane to the direction
Ctrl + b↑
Switch to next pane
Ctrl + bo
Toggle last active pane
Ctrl + b;
Show pane numbers
Ctrl + bq
Switch/select pane by number
Ctrl + bq0...9
Rotate panes in current window
Ctrl + bCtrl + o
Move the current pane left
Ctrl + b{
Move the current pane right
Ctrl + b}
Convert pane into a window
Ctrl + b!
Toggle between pane layouts
Ctrl + bSpacebar
Resize current pane height(holding second key is optional)
Ctrl + b↑
Resize current pane width(holding second key is optional)
Ctrl + b→
Resize current pane by 5 cells at a time
Ctrl + bAlt + ↑
Join two windows as panes (Merge window 2 to window 1 as panes)
: join-pane -s 2 -t 1Toggle synchronize-panes(send command to all panes)
: setw synchronize-panes// copy mode
17 commandsUse vi keys in buffer
: setw -g mode-keys viEnter copy mode
Ctrl + b[
Enter copy mode and scroll one page up
Ctrl + bPgUp
Quit mode
q
Go to top line
g
Go to bottom line
G
Scroll half page up / down
Ctrl + u
Search forward
/
Search backward
?
Next / previous keyword occurrence
n
Start selection
Spacebar
Clear selection
Esc
Copy selection
Enter
Paste contents of buffer_0
Ctrl + b]
Copy entire visible contents of pane to a buffer
: capture-paneShow all buffers
: list-buffersShow all buffers and paste selected
: choose-buffer// misc
9 commandsEnter command mode
Ctrl + b:
Set OPTION for all sessions
: set -g OPTIONSet OPTION for all windows
: setw -g OPTIONEnable mouse mode
: set mouse onReload tmux configuration
$ tmux source-file ~/.tmux.confSet window numbering to start at 1
: set -g base-index 1Set scrollback buffer limit
: set -g history-limit 10000Send keys to a pane
$ tmux send-keys -t mysession:0 'ls -la' EnterClear pane scrollback history
: clear-history