Skip to content

Instantly share code, notes, and snippets.

@Geraint
Last active December 29, 2015 20:29
Show Gist options
  • Save Geraint/7724164 to your computer and use it in GitHub Desktop.
Save Geraint/7724164 to your computer and use it in GitHub Desktop.
Cheat-sheet for tmux

tmux Cheat Sheet

Session management

Creating sessions

  • tmux - creates a new session
  • tmux new-session - also creates a new session
  • tmux new-session -s foo - creates a new session named foo
  • tmux new -s foo - also creates a new session named foo

Detaching from a running session

  • PREFIX d

Renaming a running session

  • PREFIX $

Listing existing sessions

  • tmux list sessions
  • tmux ls
  • PREFIX s

Attaching to existing sessions

  • tmux attach - attach to most recently used session
  • tmux attach -t foo - attach to session named foo

Killing existing sessions

  • tmux kill-session -t foo

Window management

Creating windows

  • PREFIX c - creates a session within a running tmux session

Navigating windows

  • PREFIX n - next window
  • PREFIX p - previous window
  • PREFIX 0 - jump to window 0 (works with any digit 0-9)
  • PREFIX f - find window (by name)
  • PREFIX w - choose window from a list

Closing windows

  • PREFIX & - prompt to close current window

Naming windows

  • PREFIX , - prompt to name current window

Pane management

Creating panes

  • PREFIX % - split vertically
  • PREFIX " - split horizontally

Navigating panes

  • PREFIX o - next pane
  • PREFIX <arrow key> - switch to pane above, below, to the left, or to the right

Pane layouts

Default layouts

  • even-horizontal
  • even-vertical
  • main-horizontal
  • main-vertical
  • tiled

You can cycle through these PREFIX <spacebar>

Re-arranging pane layouts

  • PREFIX C-o - rotate the panes in the current window forwards
  • PREFIX M-o - rotate the panes in the current window backwards

Closing panes

  • PREFIX x

Turing a pane into a new window

  • PREFIX !

Turning a window into a pane

In command mode (PREFIX :):

  • join-pane -s [session-name]:[window-number].[pane-number]

Zooming (maximizing) the current pane

  • PREFIX z - this toggles the zoomed state

Command Mode

  • PREFIX : - enter command mode

Within command mode, you can issue commands:

  • new-window -n bar - create a new window called bar
  • new-window -n bar "top" - create a new window called bar and execute top

Copy and Paste

  • PREFIX [ - enter Copy Mode.

    within Copy Mode, you can:

    • ENTER - exit Copy Mode
    • SPACE - start a selection at the current cursor position

Movement (with vi mode enabled)

  • CONTROL-B - back a page
  • CONTROL-F - forward a page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment