# session $ tmux new-session # Creates a new session without a name. Can be shortened to tmux new or simply tmux. $ tmux new -s <name> # Create named session $ tmux new -s <s> -n <w> # Create named session and name first window $ tmux new -s <name> -d # create new session, detach ! d # detach session $ tmux list-sessions # list sessions, shortened to tmux ls $ tmux attach # attach session, shortened to tmux at $ tmux attach -t <session> # attach session $ tmux kill-session -t <s> # kill session ! ( # goto previous session ! ) # goto next session ! s # list sessions
# window ! c # create new window ! , # rename window ! . # move window ! n # next window ! p # previous window ! [0-9] # go to window ! w # select window ! f # find and select window ! & # close window ! ! # Turning a Pane into a Window : join-pane -s <src> -t <dst> # take <src> join to <dst>, default is current window # the form of <src> is `[session_name]:[window].[pane]` : move-window -s <src> -t <dst> # move window
# pane ! % # vertically split ! " # horizontally split ! q # display pane number ! o # move to pane ! <UP> <DOWN> <LEFT> <RIGHT> # move to pane ! <SPACE> # change pane layout ! z # Maximizing and Restoring Panes ! x # close pane, close window if no pane left $ exit # close pane, close window if no pane left, close session if no window left
! : # command mode : new-window -n <w> "proc" # create named window run proc
! [ # copy mode ~ ENTER # quit copy mode ~ w b <C-f> <C-b> h j k l f F G / ? n N # the same as vi, use `g` goto top ~ SPACE <select text> ENTER # copy text ! ] # paste text : capture-pane # capture pane into paste buffer $ tmux show-buffer # display buffer $ tmux save-buffer <path> # save buffer to file $ tmux list-buffers # list buffers $ tmux choose-buffer # choose buffer ! = # choose buffer