Skip to content

Instantly share code, notes, and snippets.

@fr1sk
Last active March 29, 2019 14:00
Show Gist options
  • Save fr1sk/364f9704cfb599cbd97b736b3da1ae2b to your computer and use it in GitHub Desktop.
Save fr1sk/364f9704cfb599cbd97b736b3da1ae2b to your computer and use it in GitHub Desktop.
Cheat Sheet of helpful Tmux commands

Tmux panes

CTRL-b, " - Split window horizontally (i.e. split and add a pane below).

CTRL-b, % - Split window vertically (i.e. split and add a pane to the right).

CTRL-b, UpArrow - Move to the pane above (I prefer to rebind this to CTRL-b, k to be similar to Vim).

CTRL-b, DownArrow - Move to the pane below (I prefer to rebind this to CTRL-b, j to be similar to Vim).

CTRL-b, LeftArrow - Move to the pane to the left (I prefer to rebind this to CTRL-b, h to be similar to Vim).

CTRL-b, RightArrow - Move to the pane to the right (I prefer to rebind this to CTRL-b, l to be similar to Vim).

CTRL-b, z - Toggle maximization of current pane.

CTRL-b, ESC, 2 - Resize all panes to equal size.

CTRL-b, { - Swap current pane and pane to the left

CTRL-b, } - Swap current pane and pane to the rigth

CTRL-b, SPACE - Toggle between layouts

CTRL-b, q - Show pane numbers.

CTRL-b, x - Kill current pane.


Tmux windows

CTRL-b, c - Create a new window.

CTRL-b, n - Switch to next window.

CTRL-b, p - Switch to previous window.

CTRL-b, 3 - Switch to window 3.


Tmux sessions

tmux new - Create and attach to a new session.

tmux new -s NAME_HERE - Create and attach to a new session named NAME_HERE.

CTRL-b, d - Detach (i.e. exit) from the currently-opened tmux session (alternatively, tmux detach). Note, this means press and hold CTRL, press b, release both, press d.

tmux ls - Show list of tmux sessions.

tmux kill-server - Kill all tmux sessions.

tmux a - Attach to the previously-opened tmux session.

tmux a -t NAME_HERE - Attach to the tmux session named NAME_HERE.

CTRL-d - Delete (i.e. kill) currently-opened tmux session (alternatively tmux kill-session).

CTRL-b, [ - Enter copy mode, and enable scrolling in currently-opened tmux session. Press q to exit.

CTRL-b, CTRL-b, COMMAND - Send the command to a nested tmux session (repeat prefix for each level of nesting).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment