Skip to main content

tmux

New session

tmux new[-session] [-n <session name>]

Attach session

tmux a[ttach[-session]] [<option>] [-t <session name>]
OptionDescription
-dDetach other clients

Command

In CLI

tmux <command>

In tmux

Default prefix key: Ctrl + b

Execute command

  • <prefix key>
  • Key or :<command>
KeyCommandAliasDescription
:<command><command>Command
?list-keyslskList keys binding
ddetach-clientdetachDetach
Dchoose-clientDetach other clients
bind-key [-n] [-t <table>] <key> <command> [<arguments>]bindBind key
unbind-key [-n] [-t <table>] <key>unbindUnbind key
[copy-modeCopy mode
]paste-bufferPaste buffer
=choose-bufferChoose buffer

Session

KeyCommandAliasDescription
list-sessionslsList session
schoose-treeTree mode for all session

Window

KeyCommandAliasDescription
cnew-window [-n<name>] <command>newwNew window
% "split-window [-h] <command>splitwSplit window
0 to 9select-window [-t <window>]selectwSelect window
pprevious-windowprevPrevious window
nnext-windownextNext window
llast-windowlastLast window
wchoose-windowTree mode for all window of attached session
ffind-windowFind window or pane
&kill-windowkillwKill current window

Pane

KeyCommandAliasDescription
Up Down Left Rightselect-pane [-U] [-D] [-L] [-R]selectpSelect pane
qdisplay-panesdisplaypPrint pane numbers
xkill-panekillpKill active pane
kill-serverKill server
kill-sessionKill session
zresize-pane -ZZoom / UnZoom / Maximize

Layout

KeyCommandAliasDescription
Spacenext-layoutNex layout
Alt + 1 to Alt + 5select-layout <layout>Select layout

Config

~/.tmux.conf
# Comment
<command>

Mouse

Ref: Getting-Started

Enable mouse

:set -g mouse on

Tree mode

KeyFunction
EnterChange the attached session, current window or active pane
UpSelect previous item
DownSelect next item
RightExpand item
LeftCollapse item
xKill selected item
XKill tagged items
<Scroll preview left
>Scroll preview right
Ctrl + sSearch by name
nRepeat last search
tToggle if item is tagged
TTag no items
Ctrl + tTag all items
:Prompt for a command to run for the selected item or each tagged item
OChange sort field
rReverse sort order
vToggle preview
qExit tree mode

Copy mode

Default: emacs key

Use vi key

{VISUAL|EDITOR}={vi|vim|nvi}
Commandvi Keyemacs Key
begin-selectionSpaceCtrl + Space
cancelqEscape
copy-selection-and-cancelEnterAlt + w
cursor-upkUp
cursor-downjDown
cursor-lefthLeft
cursor-rightlRight
start-of-line0Ctrl + a
back-to-indentation^Alt + m
end-of-line$Ctrl + e
goto-line:g
halfpage-downCtrl + dAlt + Down
halfpage-upCtrl + uAlt + Up
page-downCtrl + fPage Down
page-upCtrl + bPage Up
history-bottomGAlt + >
history-topgAlt + <
search-forward/Ctrl + s
search-againnn
search-reverseNN
select-lineV