Skip to content

Instantly share code, notes, and snippets.

@karakays
Forked from andreyvit/tmux.md
Last active April 7, 2020 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karakays/5a19d9e1a90a972ac11ef02218ee709f to your computer and use it in GitHub Desktop.
Save karakays/5a19d9e1a90a972ac11ef02218ee709f to your computer and use it in GitHub Desktop.
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Clients, sessions, windows, panes

tmux-server manages

  • Session is a set of windows, plus a notion of which window is current.

  • Window is a single screen covered with panes. (Once might compare it to a ‘virtual desktop’ or a ‘space’.)

  • Pane is a rectangular part of a window that runs a specific command, e.g. a shell.

  • Client is attached to a session.

Lost between sessions, windows and panes?

Get information where you are at the moment

C-b i           print current client/session/window/pane

Managing sessions

Creating a session:

tmux new-session -s work

Create a new session that shares all windows with an existing session, but has its own separate notion of which window is current:

tmux new-session -s work2 -t work

Attach to a session:

tmux attach -t work

Detach from a session: C-a d.

Switch between sessions:

C-a (          previous session
C-a )          next session
C-a L          ‘last’ (previously used) session
C-a s          choose a session from a list

Other:

C-a $          rename the current session
C-a

Managing windows

Create a window:

C-a c          create a new window

Switch between windows:

C-a 1 ...      switch to window 1, ..., 9, 0
C-a 9
C-a 0
C-a p          previous window
C-a n          next window
C-a l          ‘last’ (previously used) window
C-a w          choose window from a list

Switch between windows with a twist:

C-a M-n        next window with a bell, activity or
               content alert
C-a M-p        previous such window

Copy mode

Forget about the mouse.

Copy mode has two purposes

  • Copy text anywhere in the scrollbuffer

  • Navigate terminal output history in the scrollbuffer

    C-b [ Go into copy mode

Paste

C-b [          Go into copy mode
Select text and press enter to copy
C-b ]          And paste 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment